Import A BSON Collection Into MongoDB

If you need to import a collection into your MongoDB database, you can do so with the following command (assuming it is a ‘.bson’ file):

mongorestore -d destination_database -c destination_collection filetoimport.bson

The ‘-d’ refers to ‘database’, so that’s where you enter the name of the database you’re importing the collection to. ‘-c’ refers to collection that you’re copying the data to.