Friday, March 30, 2012
MongoDB: copy collections
Recently I got involved in the node.js type of project, with MongoDB back-end. Last time I played with MongoDB was more than a year ago, so I'm pretty much refreshing my memory at this point.
Here is, for example how to copy the data from one collection to another:
db.srcCollection.find().forEach( function(c){db.destCollection.insert(c)} )
Subscribe to:
Post Comments (Atom)
1 comment:
awesome! thx for this quick fix
Post a Comment