> db.foo.drop()
|
true
|
|
> db.foo.insert({x:new DBRef('foo','bar')})
|
WriteResult({ "nInserted" : 1 })
|
|
> db.foo.find()
|
{ "_id" : ObjectId("567ac099ca24f37828635372"), "x" : DBRef("foo", "bar") }
|
|
> db.foo.find({},{"x.$id":1})
|
{ "_id" : ObjectId("567ac099ca24f37828635372"), "x" : { "$id" : "bar" } }
|
|
> db.foo.aggregate([{$match:{"x.$id": "bar"}}])
|
{ "_id" : ObjectId("567ac099ca24f37828635372"), "x" : DBRef("foo", "bar") }
|
|
> db.foo.aggregate([{$match:{"x.$id": "bar"}}, {$project:{"x.$id": 1}}])
|
assert: command failed: {
|
"ok" : 0,
|
"errmsg" : "FieldPath field names may not start with '$'.",
|
"code" : 16410
|
} : aggregate failed
|
_getErrorWithCode@src/mongo/shell/utils.js:23:13
|
doassert@src/mongo/shell/assert.js:13:14
|
assert.commandWorked@src/mongo/shell/assert.js:266:5
|
DBCollection.prototype.aggregate@src/mongo/shell/collection.js:1215:5
|
@(shell):1:1
|
|
2015-12-23T10:42:21.414-0500 E QUERY [thread1] Error: command failed: {
|
"ok" : 0,
|
"errmsg" : "FieldPath field names may not start with '$'.",
|
"code" : 16410
|
} : aggregate failed :
|
_getErrorWithCode@src/mongo/shell/utils.js:23:13
|
doassert@src/mongo/shell/assert.js:13:14
|
assert.commandWorked@src/mongo/shell/assert.js:266:5
|
DBCollection.prototype.aggregate@src/mongo/shell/collection.js:1215:5
|
@(shell):1:1
|
|
> db.foo.aggregate([{$match:{"x.$id": "bar"}}, {$group:{_id:"$x.$id"}}])
|
assert: command failed: {
|
"ok" : 0,
|
"errmsg" : "FieldPath field names may not start with '$'.",
|
"code" : 16410
|
} : aggregate failed
|
_getErrorWithCode@src/mongo/shell/utils.js:23:13
|
doassert@src/mongo/shell/assert.js:13:14
|
assert.commandWorked@src/mongo/shell/assert.js:266:5
|
DBCollection.prototype.aggregate@src/mongo/shell/collection.js:1215:5
|
@(shell):1:1
|
|
2015-12-23T10:43:09.515-0500 E QUERY [thread1] Error: command failed: {
|
"ok" : 0,
|
"errmsg" : "FieldPath field names may not start with '$'.",
|
"code" : 16410
|
} : aggregate failed :
|
_getErrorWithCode@src/mongo/shell/utils.js:23:13
|
doassert@src/mongo/shell/assert.js:13:14
|
assert.commandWorked@src/mongo/shell/assert.js:266:5
|
DBCollection.prototype.aggregate@src/mongo/shell/collection.js:1215:5
|
@(shell):1:1
|
|
> db.foo.aggregate([{$match:{"x.$id": "bar"}}, {$group:{_id:"$_id"}}])
|
{ "_id" : ObjectId("567ac099ca24f37828635372") }
|