We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
itzvarman opened DATAMONGO-2546 and commented
I have data set after projecting project("name") which gave you following data
project("name")
{ "_id": 1, "name":"Maths" }, { "_id": 1, "name":"Maths" }, { "_id": 2, "name":"Science" }, { "_id": 2, "name":"Science" }
I try to group using
group("_id").first("name").as("name")
It throws Invalid reference _id error. But when I do like following its working fine
_id
aggregationOperationContext -> { return new Document("$group", new Document("_id", "$_id").append("name", new Document("$first", "$name"))); }
Finally I projected the _id field also, then group("_id").first("name").as("name") working fine.
In my document class, I have private ObjectId _id;
private ObjectId _id;
Reference URL: https://stackoverflow.com/questions/61745356/group-by-id-doesnt-work-in-spring-data-mongodb?noredirect=1#comment109225421_61745356
The text was updated successfully, but these errors were encountered:
Christoph Strobl commented
thanks for reporting - we'll make sure the default _id field does not have to be explicitly mentioned by the ProjectOperation
ProjectOperation
Sorry, something went wrong.
This issue has been addressed via #3542.
christophstrobl
No branches or pull requests
itzvarman opened DATAMONGO-2546 and commented
I have data set after projecting
project("name")
which gave you following dataI try to group using
It throws Invalid reference
_id
error. But when I do like following its working fineFinally I projected the
_id
field also, thengroup("_id").first("name").as("name")
working fine.In my document class, I have
private ObjectId _id;
Reference URL: https://stackoverflow.com/questions/61745356/group-by-id-doesnt-work-in-spring-data-mongodb?noredirect=1#comment109225421_61745356
The text was updated successfully, but these errors were encountered: