Uploaded image for project: 'Node Driver'
  1. Node Driver
  2. NODE-351

Documents with a key "result" that's an array get clobbered

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker - P1
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.0.14, 1.4.29
    • Component/s: None
    • Labels:
      None

      Description

      Code:

      var mongodb = require('mongodb');
       
      mongodb.MongoClient.connect('mongodb://localhost:27017', function(error, db) {
        db.dropDatabase(function() {
          db.collection('test').insert({ name: 'Val', result: [{ x: 1 }] }, function() {
            db.collection('test').findOne({ name: 'Val' }, function(error, doc) {
              console.log(JSON.stringify(doc));
            });
          });
        });
      });

      Output:

      {"x":1}

      As a result of the following code in mongodb-core: https://github.com/christkv/mongodb-core/blob/d57b52f8efffaa6c16e598a119fe65737a00c7c6/lib/cursor.js#L193-196

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: