Home:ALL Converter>MongoError: driver is incompatible with this server version?

MongoError: driver is incompatible with this server version?

Ask Time:2015-10-30T16:01:28         Author:Shubham Batra

Json Formatter

This is dependency on my program :

var express = require('express'),
    app = express(),
    cons = require('consolidate'),
    MongoClient = require('mongodb').MongoClient,
    mongodb = require('mongodb'),
    Server = require('mongodb').Server;


var mongoclient = new MongoClient(new Server("localhost", 27017));
var db = mongoclient.db('prisync_mamy');

This query working fine in nodejs with mongo 2.6

 db.collection('coll').insert_one(documen , function(err , records){
                if (err) throw err;
            });

but when upgrade mongo 2.6 to 3.x then it gives error :

MongoError: driver is incompatible with this server version at Object.toError (/home/ekodev/Documents/ComParice/node_modules/mongodb/lib/mongodb/utils.js:110:11) at __executeInsertCommand (/home/ekodev/Documents/ComParice/node_modules/mongodb/lib/mongodb/db.js:1829:27) at Db._executeInsertCommand (/home/ekodev/Documents/ComParice/node_modules/mongodb/lib/mongodb/db.js:1930:5) at insertAll (/home/ekodev/Documents/ComParice/node_modules/mongodb/lib/mongodb/collection/core.js:205:13) at Collection.insert (/home/ekodev/Documents/ComParice/node_modules/mongodb/lib/mongodb/collection/core.js:35:3) at app.get.pro_url (/home/ekodev/Documents/ComParice/app.js:72:47)
at callbacks (/home/ekodev/Documents/ComParice/node_modules/express/lib/router/index.js:164:37) at param (/home/ekodev/Documents/ComParice/node_modules/express/lib/router/index.js:138:11) at pass (/home/ekodev/Documents/ComParice/node_modules/express/lib/router/index.js:145:5) at Router._dispatch (/home/ekodev/Documents/ComParice/node_modules/express/lib/router/index.js:173:5)

Author:Shubham Batra,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/33431205/mongoerror-driver-is-incompatible-with-this-server-version
Alok Deshwal :

open cmd and type the following command \n\n npm install [email protected]\n\n\nAnd then run replace your code with the following code\n\n var express = require('express'),\n app = express(),\n MongoClient = require('mongodb').MongoClient,\n mongodb = require('mongodb'),\n Server = require('mongodb').Server;\n\n var MongoClient = require('mongodb').MongoClient\n , Server = require('mongodb').Server;\n\n var mongoClient = new MongoClient(new Server('localhost', 27017));\n mongoClient.open(function(err, mongoClient) {\n var db1 = mongoClient.db(\"mydb\");\n console.log('it\\'s working ');\n mongoClient.close();\n });\n",
2015-10-30T12:18:12
yy