How to export MongoDB collection to CSV

mongoDB

mongoexport command is used to export MongoDB collection into CSV or JSON format. Syntax mongoexport –db DB_NAME –collection COLLECTION_NAME –fields FIELDS_HERE –type=csv –out NAME_OF_OUT_FILE Where DB_NAME = name of the database COLLECTION_NAME = name of the collection FIELDS_HERE = comma separated list of fields. NAME_OF_OUT_FILE = name of the CSV file By default MongoDB connect … Read more

Install MongoDB 4.0 on CentOS 7

To install MongoDB 4.0 (for other versions, see release note) on CentOS 7, create file vi /etc/yum.repos.d/mongodb-org-4.0.repo Add content [mongodb-org-4.0] name=MongoDB Repository baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/4.0/x86_64/ gpgcheck=1 enabled=1 gpgkey=https://www.mongodb.org/static/pgp/server-4.0.asc Install MongoDB with yum install -y mongodb-org Enable MongoDB start on boot systemctl enable mongod Start Mongo DB with systemctl start mongod To see mongoDB version, run [root@ns3084948 ~]# … Read more

Install MongoDB 4 on Debian 9

You can see detailed instruction on how to install on MongoDB web site. First add key apt-key adv –keyserver hkp://keyserver.ubuntu.com:80 –recv 9DA31620334BD75D9DCB49F368818C72E52529D4 For Debian 8, run echo “deb http://repo.mongodb.org/apt/debian jessie/mongodb-org/4.0 main” > /etc/apt/sources.list.d/mongodb-org-4.0.list For Debian 9, run echo “deb http://repo.mongodb.org/apt/debian stretch/mongodb-org/4.0 main” > /etc/apt/sources.list.d/mongodb-org-4.0.list Now install mongoDB with apt-get update apt-get install -y mongodb-org Once … Read more

Getting Started with MongoDB

After MongoDB is installed, you can start MongoDB client with command. mongo List All Databases To see list of all available database, use show dbs Create A Database To create a database, run use DB_NAME This will create a new database if not present and switch to it. See all Collections Once you switched to … Read more

Install MongoDB in Ubuntu

To install MongoDB in Ubuntu/Debian, run apt install mongodb Configuration file for MongoDB is /etc/mongodb.conf To see status of MongoDB, run systemctl status mongodb To start/stop systemctl start mongodb systemctl stop mongodb Create a User mongo use admin db.createUser({user: “root”, pwd: “serverok123”, roles:[“root”]}) Now you need to enable authentication, this can be done by editing … Read more

Install MongoDB on CentOS 7

To find latest MongoDB version, see https://docs.mongodb.com/manual/release-notes/ To install MongoDB 3.6 on CentOS 7, create file vi /etc/yum.repos.d/mongodb-org-3.6.repo Add [mongodb-org-3.6] name=MongoDB Repository baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.6/x86_64/ gpgcheck=1 enabled=1 gpgkey=https://www.mongodb.org/static/pgp/server-3.6.asc Refer https://docs.mongodb.com/master/tutorial/install-mongodb-on-red-hat/ Now install MongoDB with yum install mongodb-org Enable MongoDB start on boot with systemctl enable MongoDB To start MongoDB, run systemctl start mongod You can check status … Read more

MongoDB

MongoDB is an open-source NoSQL database. https://www.mongodb.com Connecting to MongoDB with user/pass Install MongoDB Backup MongoDB Free MongoDB hosting