Skip to content

Instantly share code, notes, and snippets.

@danilobatistaqueiroz
Last active September 27, 2018 13:47
Show Gist options
  • Select an option

  • Save danilobatistaqueiroz/093a88cb015040e90d99f403c7d134f3 to your computer and use it in GitHub Desktop.

Select an option

Save danilobatistaqueiroz/093a88cb015040e90d99f403c7d134f3 to your computer and use it in GitHub Desktop.
installing mongodb

Installing MongoDB on Windows

access: https://www.mongodb.com/download-center#community

create directories:
mkdir c:\mongodb\data\db
mkdir c:\mongodb\data\log

create a file at root folder named mongod.cfg:

systemLog:
    destination: file
    path: c:\mongodb\data\log\mongod.log
storage:
    dbPath: c:\mongodb\data\db

starting daemon:
c:\mongodb\bin\mongod -f c:\mongodb\mongod.cfg

opening mongo client:
c:\mongodb\bin\mongo

accessing (or creating) a database:
use <collection_name>

listing databases:
db.adminCommand( { listDatabases: 1 } )
See all your databases:
show dbs

listing collections in your selected database:
db.getCollectionInfos();
Show the collections
show collections

See all the data
db.collection_name.find()
or
db.collection_name.find().pretty()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment