Created
August 18, 2011 04:12
-
-
Save fengmk2/1153280 to your computer and use it in GitHub Desktop.
mongoskin unique index insert no error
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var db = require('mongoskin').db('localhost:27017/taohistorytest'); | |
db.bind('histories'); | |
db.histories.ensureIndex('num_iid', true, function() {console.log(arguments);}); | |
db.histories.find().toArray(function(err, items){ | |
console.log(arguments); | |
}); | |
db.histories.insert({num_iid: 1, title: 'test title'}, function() { | |
console.log(arguments); | |
}); | |
// 重复执行多次 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
{unique:true} 表示唯一索引,否则只是搜索优化的索引