Yet again the MongoDB documentation comes to the rescue
assuming that the collection actually is named “demo1.categories”:
db.demo1.categories.find().forEach( function(x){db.demo2.categories.insert(x)} );
More Related Contents:
- How to select a single field for all documents in a MongoDB collection?
- How to copy a collection from one database to another in MongoDB
- How does MongoDB sort records when no sort order is specified?
- How to listen for changes to a MongoDB collection?
- Cascade style delete in Mongoose
- Add new field to every document in a MongoDB collection
- Check that Field Exists with MongoDB
- ‘Failed to unlink socket file” error in MongoDB 3.0
- MongoDB aggregation comparison: group(), $group and MapReduce
- Best practice to maintain a mgo session
- MongoDB group by array inner-elements
- Multiple Counts with single query in mongodb
- NoSQL (MongoDB) vs Lucene (or Solr) as your database [closed]
- Delete everything in a MongoDB database
- How to return array of string with mongodb aggregation
- How to return just the nested documents of an array from all documents
- Mongoose’s find method with $or condition does not work properly
- return query based on date
- How does MongoDB deal with concurrent updates?
- MongoDB print distance between two points
- mgo – query performance seems consistently slow (500-650ms)
- mongodb – Find document with closest integer value
- querying a collection without passing schema in mongoose
- Update a value in MongoDB based on its current value
- How to connect to external MongoDB instance in Meteor?
- Find documents whose array field contains at least n elements of a given array
- Generating a Structure for Aggregation
- What is the difference between save and insert in Mongo DB?
- MongoDB: how to count number of keys in a document?
- Query for a field in an object in array with Mongo?