我收到以下错误消息:
========================================================================================
= 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 =
========================================================================================
我已经在本地mongodb中找到了处理它的方法,但是有没有方法使用mongoskin设置safe变量?
澄清:尽管有错误,我还是能够查询数据库并将字符串输出到控制台。但是,如果我想返回变量以便将其传递给另一个函数,我将得到:
{ emitter: { _events: { open: [Object] }, _maxListeners: 50 },
state: 1,
options: undefined,
skinDb:
{ emitter: { _events: [Object], _maxListeners: 100 },
state: 1,
_dbconn:
{ databaseName: 'titles',
serverConfig: [Object],
options: [Object],
_applicationClosed: false,
native_parser: true,
bsonLib: [Object],
bson: {},
bson_deserializer: [Object],
bson_serializer: [Object],
_state: 'connecting',
pkFactory: [Object],
forceServerObjectId: false,
safe: true,
notReplied: {},
isInitializing: true,
auths: [],
openCalled: true,
commands: [],
_callBackStore: [Object],
logger: [Object],
slaveOk: false,
tag: 1352682584657,
eventHandlers: [Object],
serializeFunctions: false,
raw: false,
recordQueryStats: false,
reaperEnabled: false,
_lastReaperTimestamp: 1352682584657,
retryMiliSeconds: 1000,
numberOfRetries: 60,
reaperInterval: 10000,
reaperTimeout: 30000,
readPreference: undefined },
db: null,
username: '',
password: undefined,
admin: { emitter: {}, state: 0, skinDb: [Circular], admin: null },
_collections: { titles: [Circular] },
bson_serializer:
{ BSON: [Object],
Long: [Object],
ObjectID: [Object],
DBRef: [Function: DBRef],
Code: [Function: Code],
Timestamp: [Object],
Binary: [Object],
Double: [Function: Double],
MaxKey: [Function: MaxKey],
MinKey: [Function: MinKey],
Symbol: [Function: Symbol] },
ObjectID:
{ [Function: ObjectID]
index: 0,
createPk: [Function: createPk],
createFromTime: [Function: createFromTime],
createFromHexString: [Function: createFromHexString] } },
ObjectID:
{ [Function: ObjectID]
index: 0,
createPk: [Function: createPk],
createFromTime: [Function: createFromTime],
createFromHexString: [Function: createFromHexString] },
collectionName: 'titles',
collection: null,
internalHint: null,
hint: [Getter/Setter] }
最佳答案
在官方Mongoskin Issue Tracker中查看此页:https://github.com/kissjs/node-mongoskin/issues/77
关于mongodb - 如何在mongoskin中设置安全变量?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/13335379/