Skip to content

Instantly share code, notes, and snippets.

@yssk22
Created November 19, 2011 14:09
Show Gist options
  • Save yssk22/1378865 to your computer and use it in GitHub Desktop.
Save yssk22/1378865 to your computer and use it in GitHub Desktop.
node-mongodb-native について(エラーがでるコード)
> var server = new (require('mongodb').Server)('localhost', 27017);
> var db = new (require('mongodb').Db)('foo', server);
> db.open(function(){
... db.collection('foo', function(_, collection){
... collection.insert([{"_id": 'foo'}, {"_id": 'foo'}], {safe:true}, function(e){ console.log(e); })
... });
... });
> { stack: [Getter/Setter],
arguments: undefined,
type: undefined,
message: 'E11000 duplicate key error index: foo.foo.$_id_ dup key: { : "foo" }',
name: 'MongoError',
err: 'E11000 duplicate key error index: foo.foo.$_id_ dup key: { : "foo" }',
code: 11000,
n: 0,
connectionId: 1,
ok: 1 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment