Therefore, when your syntax is fixed due to misuse:
db.dummy_data.ensureIndex({ "url": 1},{ "unique": true, "dropDups": true })
It is reported that you are still receiving an error message, but a new one:
{ "connectionId": 336, "err": " dropDups = true", "code": 10092, "n": 0, "ok": 1}
google, :
, ,
, 1000000. , , : " , , ram ". ( == 1000000), , makeIndex {dropDups: true} reimport .
, .
, , . :
db.newdata.ensureIndex({ "url": 1},{ "unique": true, "dropDups": true });
db.dummy_data.find().forEach(function(doc) {
db.newdata.insert(doc);
});
:
db.newdata.ensureIndex({ "url": 1},{ "unique": true, "dropDups": true });
var bulk = db.newdata.initializeUnOrderedBulkOp();
var counter = 0;
db.dummy_data.find().forEach(function(doc) {
counter++;
bulk.insert( doc );
if ( counter % 1000 == 0 ) {
bulk.execute();
bulk = db.newdata.initializeUnOrderedBulkOp();
}
});
if ( counter % 1000 != 0 )
bulk.execute();
, , , -, .