Details
-
Improvement
-
Resolution: Won't Do
-
Major - P3
-
None
Description
Description
In SERVER-46422 a user was confused about why the following $project/$addFields is invalid:
db.c.aggregate({$project: {a: {}}})
|
db.c.aggregate({$addFields: {a: {}}})
|
We should consider updating the docs to indicate that in these cases $literal needs to be used:
db.c.aggregate({$project: {a: {$literal: {}}}})
|
(and similar for $addFields)
Maybe this page could have a sentence or two about this:
https://docs.mongodb.com/manual/reference/operator/aggregation/project/