Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-1652

Valid JS output?

    XMLWordPrintableJSON

Details

    • Icon: Task Task
    • Resolution: Done
    • Icon: Minor - P4 Minor - P4
    • None
    • 2.13.0
    • BSON
    • None

    Description

      We use the Java driver to make requests against MongoDB instances, but also to output the JS that a user would have to execute to perform the same operation themselves (EG, in the mongo console). Using `toString` generally works – BasicDBObjects look like

      {"key": value}

      , etc. But `bson.types.Code` ends up outputting something like `{"scope": {"myFun": {"$code": "function ()

      {…}

      "}}}`, when it should be `{"scope": {"myFun": function () {…}}}}`.

      So … are we abusing toString too much? Is there some other operation that we can use to get the appropriate output? Or do we have to write the JS-compatible version ourselves?

      Thanks.

      Attachments

        Activity

          People

            Unassigned Unassigned
            sellout Greg Pfeil
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: