Details
-
Bug
-
Status: Closed
-
Major - P3
-
Resolution: Works as Designed
-
5.0.9
-
None
-
None
-
None
-
ALL
Description
db.test.insert({ a: 'a' });
|
db.test.aggregate([{ $addFields: { result: { $getField: { field: { $concat: ['$a', 'a'] }, input: { aa: 1 } } } } }]);
|
This leads to:
MongoServerError: Invalid $addFields :: caused by :: $getField requires 'field' to evaluate to a constant, but got a non-constant argument
|
I don't understand why that happens (and believe it's a bug). According to getField's documentation `field` can be any expression that resolves to a string. In my example it is such but it doesn't work.
Attachments
Issue Links
- is related to
-
SERVER-74371 Support arbitrary expressions for 'field' parameter for $getField
-
- In Code Review
-