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

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

    XMLWordPrintable

Details

    • Improvement
    • Status: Closed
    • Minor - P4
    • Resolution: Duplicate
    • None
    • None
    • JavaScript, Shell
    • None
    • 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

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

              Dates

                Created:
                Updated:
                Resolved: