Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// Use migration script https://gist.github.com/j-coll/c2b81a7ff8392ec6b5208b5a8bf0d3d3
var otherKeys = {
_id : "",
end : "",
ref : "",
alt : ""
};
migrateCollection("stage", {"_i" : {"$exists" : false} }, {}, function(bulk, doc) {
var _i = [];
for (var i in doc) {
if (!otherKeys.hasOwnProperty(i)) {
_i.push(i);
}
}
bulk.find({ "_id" : doc._id}).updateOne({ "$set" : {"_i" : _i} });
});
db.stage.ensureIndex( {"_i" : 1}, {"background" : true})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.