Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-2426

Convert/print bson undefined type as javascript undefined, not null

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor - P4
    • Resolution: Duplicate
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: JavaScript, Shell
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible

      Description

      This snippet shows how an "Undefined" (0x06) BSON value may get stored into the database.

      use tempDB;
      var obj = {};
      db.tempColl.insert(

      { data: obj.undefinedField }

      );
      db.tempColl.find(

      { data: null }

      ); // expects one document but actually returns zero documents.
      db.tempColl.find({ data: { $type: 10 }}); // expects one document but actually returns zero documents.
      db.tempColl.find({ data: { $type: 6 }}); // expects zero documents but returns one document.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              backlog-server-platform DO NOT USE - Backlog - Platform Team
              Reporter:
              buddydvd David Hu
              Participants:
              Votes:
              2 Vote for this issue
              Watchers:
              8 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: