Mongodb group by dbref field
问题 I need group products by model. Each product has model field - DBRef to Models collection. I tried use this aggregate query, but have error FieldPath field names may not start with '$'. Aggregation query: db.Products.aggregate([ { $project: { _id: 0, model: 1, isActive: 1 } }, { $group: { _id: "$model.$id", actives: { $push: "$isActive" } }} ]); Example of product document: { _id: ObjectId("54f48610e31701d2184dede5"), isActive: true, model: { $db: "database", $ref: "Models", $id: ObjectId("..