Skip to content

Instantly share code, notes, and snippets.

@dohaivu
Last active January 9, 2018 00:03
Show Gist options
  • Save dohaivu/62c9e6fea6040da562d810910c260d1a to your computer and use it in GitHub Desktop.
Save dohaivu/62c9e6fea6040da562d810910c260d1a to your computer and use it in GitHub Desktop.
[mongodb setup]

Setup

# start
./bin/mongod --dbpath /Users/haivu/dev/mongodb-osx-x86_64-3.6.1/data

Commands

mongo [server]//mongo shell
mongo 127.0.0.1:27017

// get current database
db

//list db
show dbs

// create database
use testData

show collections

//insert into testData Collection
db.testData.insert({name: haivu});

db.testData.find()

db.collection.find()
db.collection.findOne()
db.collection.aggregate()
db.collection.count()
db.collection.distinct()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment