Category Archives: MongoDB

Scripting for Mongo

Sometimes you want to automate certain tasks using scripts. MongoDB also supports this: http://docs.mongodb.org/manual/tutorial/write-scripts-for-the-mongo-shell/

Posted in MongoDB, shell | Tagged , , , , , | Leave a comment

Delete entire database from mongo from cmd line

To quickly delete / remove a entire database from mongo you can use the command line interface: volker@Volkers-MacBook-Pro ~> mongo 127.0.0.1 # connect to default port MongoDB shell version: 2.4.9 connecting to: 127.0.0.1/test > show dbs AWESOME_DB 0.203125GB local 0.078125GB … Continue reading

Posted in MongoDB, OS X | Tagged , , , , , | Leave a comment

Export data collection from mongodb to json

for exporting a data collection to a json you can use this simple command: mongoexport –jsonArray -d DATABASE-NAME -c collectionName[, collectionName2,…] To write data to a file you just append a redirect mongoexport –jsonArray -d DATABASE-NAME -c collectionName[, collectionName2,…] > … Continue reading

Posted in MongoDB | Tagged , | Leave a comment