To run mongodb do
Then to query the DB start the client by
use
To see the databases do
show databases
You can see the collections in a database after opening that database by
show collections
Collections correspond to Tables in mysql.
db.collection.find({key:value})
can be used to query the DB. If you want to perform "like" queries do
db.collection.find({"my key": /term/})
Do not use quotes around term in the previous example to perform like queries. If you do, then it will be an exact match.
This will not work within pymongo and you need to use $regex directive for this.
db["mycollection"].find({"key":{"$regex":"%s" % query}})
You can use count do count the number of matching records.
db.collection.count({key:value})
>mongodThis will start the deamon.
Then to query the DB start the client by
>mongoTo use a DB do
use
To see the databases do
show databases
You can see the collections in a database after opening that database by
show collections
Collections correspond to Tables in mysql.
db.collection.find({key:value})
can be used to query the DB. If you want to perform "like" queries do
db.collection.find({"my key": /term/})
Do not use quotes around term in the previous example to perform like queries. If you do, then it will be an exact match.
This will not work within pymongo and you need to use $regex directive for this.
db["mycollection"].find({"key":{"$regex":"%s" % query}})
You can use count do count the number of matching records.
db.collection.count({key:value})