[DOCS-8804] Document Extended JSON format for Code and CodeWScope Created: 12/Sep/16  Updated: 30/Oct/23

Status: Closed
Project: Documentation
Component/s: manual, Server
Affects Version/s: None
Fix Version/s: Server_Docs_20231030

Type: Bug Priority: Major - P3
Reporter: Thomas Rueckstiess Assignee: Unassigned
Resolution: Won't Do Votes: 0
Labels: collector-298ba4e7
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

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


Issue Links:
Duplicate
duplicates DOCS-7430 Manual page for Extended JSON incomplete Closed
duplicates DOCS-8113 MongoDB Extended JSON format for Code... Closed
Participants:
Days since reply: 1 year, 14 weeks, 2 days ago
Epic Link: DOCSP-1769

 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.



 Comments   
Comment by Education Bot [ 31/Oct/22 ]

Hello! This ticket has been closed due to inactivity. If you believe this ticket is still important, please reopen it and leave a comment to explain why. Thank you!

Generated at Thu Feb 08 07:57:00 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.