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

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

    • Type: Icon: Improvement Improvement
    • Resolution: Duplicate
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: JavaScript, Shell
    • Labels:
      None
    • Fully Compatible

      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.

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

              Created:
              Updated:
              Resolved: