Details
-
Bug
-
Resolution: Won't Do
-
Major - P3
-
None
-
*Location*: https://docs.mongodb.com/manual/reference/mongodb-extended-json/
*User-Agent*: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.89 Safari/537.36
*Screen Resolution*: 2560 x 1440
Description
Document MongoDB extended JSON syntax for the following BSON types
- javascript (type 13)
- javascript with scope (type 15)
Using the node driver to insert such types (via bson.Code()), then mongoexport-ing the documents, the strict extended json syntax seems to be:
Javascript
{
|
"$code": "function () { return 1+1; }"
|
}
|
Javascript with Scope:
{
|
"$code": "function () { return a+b; }",
|
"$scope": {
|
"a": 1,
|
"b": 2
|
}
|
}
|
In the shell, there is a Code() helper function, but I can't find documentation for it.