Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Web Technology by (47.6k points)

How can I (in MongoDB) combine data from multiple collections into one collection?

Can I use map-reduce and if so then how?

I would greatly appreciate some examples as I am a novice.

1 Answer

0 votes
by (106k points)

To combine data from multiple collections into one there is no bulk insert into mongodb, we loop all objects in the small_collection and insert them one by one into the big_collection:

db.small_collection.find().forEach(function(obj){ 

db.big_collection.insert(obj) 

});

Related questions

0 votes
1 answer
0 votes
2 answers
0 votes
2 answers

Browse Categories

...