Last active
August 9, 2018 06:04
-
-
Save Feroz-Istar/cb2f023695ff8484223e969f3ccc2dc5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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