Comments (3)
Query for a single document should work fine. What is the value of slug which you are searching and the entry in db? It would help for you to provide some code with data for us to check.
from marten.
This is the method:
public async Task<Template?> GetBySlugAsync(string slug)
{
var templates = await _session.Query<Template>().ToListAsync();
if (templates != null) foreach (var item in templates) if (item.Slug == slug) return item;
// return await _session.Query<Template>().Where(x => x.Slug == slug).SingleOrDefaultAsync();
return default;
}
This is value of "slug" that is being passed to the method:
var slug = "my-document-template";
This is the entry in the database:
{
"id": "57b5239b-171d-4200-9bd2-ed7951d76e72",
"title": "My Document Template",
"slug": "my-document-template",
"description": "a brief Document description",
"tags": [
"first tag",
"another tag"
]
}
Retrieving the entire list and then matching on the slug returns the correct database entry.
Querying for a single document returns null.
from marten.
@johnholliday Hey, check your JSON settings in Marten. Notice that "slug" is I'm guessing camel casing in your database. Are you explicitly setting your JSON casing to CamelCase with Marten?
I'm moving this to a discussion, because it's extremely unlikely that this is anything but the JSON serialization settings.
from marten.
Related Issues (20)
- Proposal: `Events.FetchForWriting` that works with async projections HOT 3
- [7.0.rc2] Count Distinct throws error HOT 2
- ApplyEventException can leak event data to logs HOT 1
- [7.0.rc2] Variables passed into linq expressions are not being evaluated HOT 1
- Allow combining ordering with dynamic properties and case insensitivity
- Re-examine the initial high water detection in rebuild
- CAST operator missing in generated SQL HOT 5
- Expected version check doesn't work if the stream doesn't exist yet HOT 2
- FlatTableProjection doesn't play nice with AssertDatabaseMatchesConfigurationAsync HOT 2
- NodaTime projection deserialization exception HOT 1
- Marten version 6.4.1 has not been published to NuGet HOT 1
- Fix NodaTime Select(Instant) serialization. Again. HOT 1
- [BUG] Schemas not autoregenerate in development (or even in prod) HOT 1
- Sample for CustomGrouper is not robust
- NpgsqlDataSource - System.ObjectDisposedException : The semaphore has been disposed. HOT 2
- MultiStreamProjection - Identity does not support IEvent<TEvent> as identity source
- MultiStreamProjection - as async projection does not execute apply method when a lot of pending events HOT 4
- Overhaul Command Execution Pipeline HOT 6
- MultiStreamProjection is not supported with QueryAllRawEvents().AggregateTo<>()
- QueryAllRawEvents().AggregateTo() does not set document Id field
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from marten.