Repository navigation
Honor the configured identity in cursor paging validation - #5815
Merged
jeremydmiller merged 1 commit intoNov 5, 2026
Merged
jeremydmiller merged 1 commit into
jeremydmiller merged 1 commit into
Conversation
ToJsonPageByCursorAsync checked the terminal ordering against the static DocumentMapping.FindIdMember, which only knows the Id naming convention and [Identity]. A document configured with Schema.For<T>().Identity(x => x.Key) was therefore rejected with "requires the final OrderBy/ThenBy clause to be on a member guaranteed to be unique" even when ordered by its identity. Resolve the identity from the store's mapping of the query's source document type instead. Part of JasperFx#5814 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
BinaryTENSHi
marked this pull request as draft
November 4, 2026 16:09
BinaryTENSHi
marked this pull request as ready for review
November 4, 2026 18:03
This was referenced Nov 6, 2026
Closed
This was referenced Nov 13, 2026
This was referenced Nov 15, 2026
This was referenced Nov 22, 2026
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #5814. This covers the
.Identity(x => x.Key)case on a plainGuid.Cursor paging with strong-typed ids will come in a separate PR, so the issue should stay open.
Problem
ToJsonPageByCursorAsyncvalidates that the last ordering is on the document identity using the staticDocumentMapping.FindIdMember(typeof(T)). That only knows theIdnaming convention and[Identity], so a document configured withSchema.For<T>().Identity(x => x.Key)throwsInvalidOperationExceptioneven when it is ordered by its identity.Fix
Read
IdMemberfrom the store's mapping of the query's source document type. Using the source type rather thanTmeans a projectedT, such asSelect(x => x.FirstName), still gets the existing validation error instead of a mapping lookup forstring.Behavior change
A document with
.Identity(x => x.Key)that also has an ordinaryIdmember used to pass validation when ordered byId, even though nothing guarantees that member is unique. It is now rejected, and the error message namesKey.Testing
cursor_paging_with_fluent_identity, which pages through documents with tied sort keys. It failed with the issue's exception before the fix.DocumentDbTests,Marten.AspNetCore.TestingandMarten.NodaTime.Testingpass locally on net10.0.🤖 Generated with Claude Code