-
Type: New Feature
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Aggregation Framework
-
Query
-
Fully Compatible
Currently a string literal as a value in a $project stage will cause an error:
db.foo.aggregate([{$project: {a: "hi"}}]) assert: command failed: { "errmsg" : "exception: FieldPath 'hi' doesn't start with $", "code" : 16873, "ok" : 0 } : aggregate failed Error: command failed: { "errmsg" : "exception: FieldPath 'hi' doesn't start with $", "code" : 16873, "ok" : 0 } : aggregate failed at Error (<anonymous>) at doassert (src/mongo/shell/assert.js:11:14) at Function.assert.commandWorked (src/mongo/shell/assert.js:254:5) at DBCollection.aggregate (src/mongo/shell/collection.js:1278:12) at (shell):1:8 2016-02-02T12:12:03.131-0500 E QUERY Error: command failed: { "errmsg" : "exception: FieldPath 'hi' doesn't start with $", "code" : 16873, "ok" : 0 } : aggregate failed at Error (<anonymous>) at doassert (src/mongo/shell/assert.js:11:14) at Function.assert.commandWorked (src/mongo/shell/assert.js:254:5) at DBCollection.aggregate (src/mongo/shell/collection.js:1278:12) at (shell):1:8 at src/mongo/shell/assert.js:13
We should allow this, with the semantics that it creates or replaces a field, and has that string literal as its value.
- depends on
-
SERVER-18966 Allow exclusion in $project stage of aggregation pipeline
- Closed
- duplicates
-
SERVER-18966 Allow exclusion in $project stage of aggregation pipeline
- Closed