Skip to content

Instantly share code, notes, and snippets.

@Feroz-Istar
Last active August 9, 2018 06:04
Show Gist options
  • Save Feroz-Istar/cb2f023695ff8484223e969f3ccc2dc5 to your computer and use it in GitHub Desktop.
Save Feroz-Istar/cb2f023695ff8484223e969f3ccc2dc5 to your computer and use it in GitHub Desktop.
1. use "Database" will create new database
2.
db.createUser( { user: "root",
pwd: "root",
roles: [ { role: "clusterAdmin", db: "admin" },
{ role: "readAnyDatabase", db: "admin" },
"readWrite"] }
)
will create a new user in this database.
3. show dbs will list all the database
4. db.movie_collection.aggregate( [ {$group:{_id:{year:"$year"},count:{$sum:1}}}] )
5. db.customerCollection.aggregate( [ {$match:{city: "East Khalil"}},{$group:{_id:{city:"$city"},count:{$sum:1}}}] )
6. db.movie_director_collection.find({"movie_id":{$in:[1]}})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment