I am trying to run a Node.js script locally and it's giving me this error message:
======================================================================================== = Please ensure that you set the default safe variable to one of the = = allowed values of [true | false | {j:true} | {w:n, wtimeout:n} | {fsync:true}] = = the default value is false which means the driver receives does not = = return the information of the success/error of the insert/update/remove = = = = ex: new Db(new Server('localhost', 27017), {safe:false}) = = = = http://www.mongodb.org/display/DOCS/getLastError+Command = = = = The default of false will change to true in the near future = = = = This message will disappear when the default safe is set on the driver Db = ========================================================================================
Here are my variables:
var express = require('express');
var mongodb = require('mongodb');
var GridStore = require('mongodb').GridStore;
var Db = require('mongodb').Db;
var Server = require('mongodb').Server;
var db = new Db(Config.dbName, new Server("127.0.0.1", 27017, {}), {});
var HttpGet = require('./httpGet').HttpGet;
var URL = require('url');
var dbClient = null; // this is initialized when db is opened
var app = module.exports = express();
The same scripts runs fine on my live server. It only complanes when I run it locally.
I found this same issue being discussed on github but found no solution. https://github.com/kissjs/node-mongoskin/issues/77
Anyone know what could cause this problem?
Thanks in advance :)
The following works for me using the 1.1.11 mongo driver:
var db = new Db(Config.dbName, new Server("127.0.0.1", 27017, {}), {safe: true});
Without the {safe: true}
parameter I do get the same warning as you show in your question.
This warning was a very recent addition to the driver; you're probably using an older version of the driver on your server which is why you don't see the warning there.
I got it to work by setting the strict
mode to false.
var db = new Db(config.dbName, new Server("127.0.0.1", 27017, {}), {safe: false, strict: false});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With