Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
var cursor = db.places.find();
while (cursor.hasNext()) {
var x = cursor.next();
x['source']['url'].replace('aaa', 'bbb'); // is this correct?
db.foo.update({_id : x._id}, x);
}
var cursor = db.places.find();
while (cursor.hasNext()) {
var x = cursor.next();
for(var i=0; i < x["suites"].length; i++){
var fotos = Array();
for(var k=0; k < x["suites"][i]["fotos"].length; k++){
fotos[k] = {"fotos" : x["suites"][i]["fotos"][k] };
}
x["suites"][i]["fotos"] = fotos;
}
db.places.update({_id : x._id}, x);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment