Typical Mongo Service (photo-share database)
mongodb://localhost:27017/photo-share
Installing mongo
brew install mongodb
Checking your services
brew services list
Starting the mongo service
brew services start mongodb
Connecting to the shell
mongo
- Clear the shell:
cls
- Exit the shell:
exit
- List databases:
show dbs
- Use a Database (photo-share):
use photo-share
- show collections:
show collections
- list data in a collection (photos):
db.photos.find().pretty()
- drop a collection (photos):
db.photos.drop()
- drop a database :
db.dropDatabase()
- Goto mLab
- Create an account
- Create a sandbox database.
- Create user for the database:
test
withpassword1
- Copy the database connection:
mongodb://test:[email protected]:15089/photo-share