Skip to content

[Spring Data MongoDB 4.2.0] MongoTemplate using incorrect nested fields order #4585

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
infoShare opened this issue Dec 8, 2023 · 1 comment
Labels
status: duplicate A duplicate of another issue

Comments

@infoShare
Copy link

When using MongoTemplate.find(...) order of the nested fields is not preserved. This might be problematic if full objects search is used (for example for indexed complex fields).

Below you can find JUnit with this issue highlighted.

Failing as query for Mongodb is:
{ "nested" : { "checkName" : "B", "checkVersion" : "1", "systemName" : "A" } }
instead of
{ "nested" : { "systemName" : "A", "checkName" : "B", "checkVersion" : "1" } }
on MongoTemplate.doFind() on line: Document mappedQuery = queryContext.getMappedQuery(entity);

https://github.com/infoShare/code-examples/blob/main/spring-data-mongodb-order/src/test/java/infoshare/springdatamongodborder/SpringDataMongodbOrderTests.java

It is working properly on spring-data-mongodb:4.1.5

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Dec 8, 2023
@christophstrobl
Copy link
Member

@infoShare thanks for reporting! This looks similar to #4577 having the root cause in #4555. Well fix this with the next service release.

@mp911de mp911de added status: duplicate A duplicate of another issue and removed status: waiting-for-triage An issue we've not yet triaged labels Dec 11, 2023
@mp911de mp911de closed this as not planned Won't fix, can't repro, duplicate, stale Dec 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: duplicate A duplicate of another issue
Projects
None yet
Development

No branches or pull requests

4 participants