node.js - Different Insert response from mongodb nodejs native driver on OSX and Windows -


i'm getting different responses when inserting documents windows , osx external mongodb database.

both systems using mongodb driver v2.1.11 https://www.npmjs.com/package/mongodb

inserts working fine on both result quite different.

osx: { result: { ok: 1, n: 1, ...other data}, ops: [the inserted records] }

win: [the inserted records]

any idea why happening?

steps reproduce:

  • nodejs: 5.7.0
  • npm: 3.6.0
  • mongodb (from npm): 2.1.11

given nodejs application, install v2.1.11 of official mongodb driver nodejs: npm install --save mongodb@2.1.11.

from nodejs application, import mongo, create mongo client , connect mongodb instance , insert document collection:

import mongo 'mongodb'; const mongoclient = mongo.mongoclient;  mongoclient.connect(mongourl, (err, db) => {      db.collection('somecollection').insert({ foo: 'foo'}, (inserr, result) => {         console.log(result); // observe result shape different on win/osx    }); }); 

it turns out there package.json buried deep in application contains lower version of mongodb driver.

removing pacakge.json , ensuring kept in top level package.json has solved problem me.


Comments