문제

I am getting 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           =
========================================================================================

I have found a way to deal with it in native MongoDB, but is there a way to set the safe variable using mongoskin?

To clarify: I am able to query the database and output a string to the console in spite of the error. However, if I want to return the variable in order to pass it to another function, I get this:

{ 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] }
도움이 되었습니까?

해결책 2

See this page in the official mongoskin issue tracker: https://github.com/kissjs/node-mongoskin/issues/77

다른 팁

Try this:

var db = mongoskin.db('localhost:27017/test', {safe: true});
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top