|
ping.
The way the shell handles "undefined" is just extremely confusing:
> a = undefined
|
> a
|
> {a: undefined}
|
>
|
> {a: undefined, b: 3}
|
2015-06-27T23:51:28.179+1000 E QUERY SyntaxError: Unexpected token :
|
> var doc = {a: undefined, b: 3}
|
> doc
|
{ "a" : undefined, "b" : 3 }
|
> db.foo.insert({"undef": undefined})
|
WriteResult({ "nInserted" : 1 })
|
> db.foo.find({"undef": {$exists: true}})
|
{ "_id" : ObjectId("558eaa95250f587c27e993a6"), "undef" : null }
|
> db.foo.find({"undef": {$type: 6}})
|
{ "_id" : ObjectId("558eaa95250f587c27e993a6"), "undef" : null }
|
Note the parsing error when the document with value undefined is not assigned to a variable, but it works when assigning it to a variable.
|