was able to speed it up quite a bit by changing
db.test.save(e);
to
db.test.update(e);
Domanda
To use the spatial functions from MongoDB I need to update the Dataset. When I run the following code over 20million documents it is still not finished after 8h.
Is there a faster way to do this?
db.eval(function() {
db.test.find({}).forEach(function(e) {
e.geometry = {"type": "Point", "coordinates": [e.SA_X_COORD, e.SA_Y_COORD]}
db.test.save(e);
});
},
{ nolock: true });
Soluzione
was able to speed it up quite a bit by changing
db.test.save(e);
to
db.test.update(e);