Closed
Description
# Entity class example
@Document(collection = "record")
public class Record {
@Id
private String id;
@Field("embedded_object")
private EmbeddedObject embeddedObject;
}
@Document(collection = "embedded_object")
public class EmbeddedObject {
@Id
private String id;
}
# Query code example
recordRepository.findAll(QRecord.record.embeddedObject.id.eq("64268a7b17ac6a00018bf312"), PageRequest.of(0,1))
# Expected correct result
find using query: { "embedded_object._id" : { "$oid" : "64268a6117ac6a00018bf30f"}} fields: Document{{}}
# Actual incorrect result
find using query: { "embedded_object._id" : "64268a6117ac6a00018bf30f"} fields: Document{{}}
Activity
[-]The createQueryFor(predicate) Method in QuerydslMongoPredicateExecutor Converts Query Conditions with Nested Objects Containing ObjectId() to Strings[/-][+]`SpringDataMongodbQuery` and `SpringDataMongodbSerializer` apply mapping twice[/+]mp911de commentedon May 28, 2024
SpringDataMongodbSerializer
used viaQuerydslMongoPredicateExecutor
applies field name customization twice. The resulting query above (used with the QueryMapper) isembedded_object._id
while it should beembeddedObject.id
. Removing field name mapping inSpringDataMongodbSerializer
seems not enough as other components break.Apply type conversion to id types.
Polishing.
Polishing.
Apply type conversion to id types.
Polishing.
Apply type conversion to id types.