You can use $$ROOT
{ $group : {
_id : "$author",
books: { $push : "$$ROOT" }
}}
Found here: how to use mongodb aggregate and retrieve entire documents
More Related Contents:
- Does MongoDB’s $in clause guarantee order
- Find document with array that contains a specific value
- Update field in exact element array in MongoDB
- How to change the type of a field?
- Mongodb sort inner array
- MongoDB logging all queries
- Return only matched sub-document elements within a nested array
- Querying internal array size in MongoDB
- How to delete N numbers of documents in mongodb
- How to enable authentication on MongoDB through Docker?
- How to insert an element to MongoDB internal list?
- How do I do a “NOT IN” query in Mongo?
- How to efficiently perform “distinct” with multiple keys?
- Hierarchical queries with Mongo using $graphLookup
- Search on multiple collections in MongoDB
- Mongo, find through list of ids
- Image returned from REST API always displays broken
- MongoDB: Server has startup warnings ”Access control is not enabled for the database”
- Spring data MongoDb: MappingMongoConverter remove _class
- How to find min value in mongodb
- Does MongoDB support floating point types?
- How to toggle a boolean field in one document with atomic operation?
- How to delete documents by query efficiently in mongo?
- Sum in nested document MongoDB
- Update embedded object inside array inside array in MongoDB
- brew services. Cant start service. get “Bootstrap failed: 5: Input/output error”
- Map-Reduce performance in MongoDb 2.2, 2.4, and 2.6
- Unique IDs with mongodb
- MongoDB count() versus countDocuments()
- Mongo $in operator performance