2

次のエラー メッセージが表示されます。

========================================================================================
=  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 を使用して安全な変数を設定する方法はありますか?

明確にするために:エラーにもかかわらず、データベースにクエリを実行し、コンソールに文字列を出力できます。ただし、別の関数に渡すために変数を返したい場合は、次のようになります。

{ 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] }
4

2 に答える 2

2

これを試して:

var db = mongoskin.db('localhost:27017/test', {safe: true});
于 2012-11-12T00:19:55.583 に答える
0

モンゴスキンの公式課題トラッカーでこのページを参照してください: https://github.com/kissjs/node-mongoskin/issues/77

于 2012-11-26T13:16:44.370 に答える