Reputation: 5000
When connecting to mongo, I have always used the recommended way
MongoClient.connect('mongodb://localhost:27017/myproject', { native_parser: true}, (err, r) => { ... })
I am updating to version 2.1 of the node-mongodb-native driver.
According to the main page http://mongodb.github.io/node-mongodb-native/2.1/whats-new/, a new JS-BSON parser has been introduced that supplants the C++ extension. Does this mean the { native_parser: true }
option is no longer needed?
Upvotes: 1
Views: 724
Reputation: 48476
Per the source code of MongoClient.connect
version 2.0
var _setNativeParser = function(db_options) {
if(typeof db_options.native_parser == 'boolean') return db_options.native_parser;
try {
require('mongodb-core').BSON.BSONNative.BSON;
return true;
} catch(err) {
return false;
}
}
The { native_parser: true}
could be used in the MongoClient.connect
function as one option parameter.
Upvotes: 1