-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Minor - P4
-
None
-
Affects Version/s: 7.0.5
-
Component/s: None
-
Query Execution
-
QE 2024-03-04, QE 2024-03-18, QE 2024-04-01, QE 2024-04-15, QE 2024-04-29, QE 2024-05-13, QE 2024-05-27, QE 2024-06-10, QE 2024-06-24, QE 2024-07-08, QE 2024-07-22, QE 2024-08-05, QE 2024-08-19, QE 2024-09-02, QE 2024-09-16, QE 2024-09-30, QE 2024-10-14, QE 2024-10-28
Running the following command on mongo v7.0.5, the error message wasn't clear for me.
Enterprise test> db.test.aggregate([ { $documents: [{ nb: [1, 2, 3] }] }, { $project: { total: { $sum: ["$nb"] } } }] ) MongoServerError: '$documents' can only be run with {aggregate: 1}
I didn't know {aggregate: 1} was the literal expression of a database or cluster-level aggregation.
Could you change the error message to make it more explicit:
MongoServerError: '$documents' can only be run with database or cluster-level aggregation {aggregate: 1}