I'm using MongoDB with Mongochef GUI over an Ubuntu Virtual Machine. I need to do a Query which insert the data that I have found previously.
How can i do this? I thought something like this:
db.createCollection("prueba", { capped : true, size : 5242880, max : 5000 } )
db.gmap.find( { emotion: 1 } )
db.prueba.insertMany(db.gmap.find( { emotion: 1 } ))
GMAP is other collection that i have and the find query returns needed data. Thanks
To solve that we need to store result as an array and then insert - please find snippet below:
var a = db.sourceCollection.find().toArray()
db.destinatioCollection.insert(a)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With