Execute MongoDB queries from command prompt
we can run mongodb queries from command prompt as well. Run command prompt in administrator mode.
Go to the mongo installation path till bin folder.
In windows, it should be like:
Use below command to execute the mongo query :
The above command will connect to the given DB details and execute the query.
It will show the data in command prompt itself.
we can run mongodb queries from command prompt as well. Run command prompt in administrator mode.
Go to the mongo installation path till bin folder.
In windows, it should be like:
c:\Program Files\Mongo\server\3.2\bin
Use below command to execute the mongo query :
mongo <hostname>:<portnumber>/<dbname> -u <user> -p <pass> db.employee.find("department" : "finance")
The above command will connect to the given DB details and execute the query.
It will show the data in command prompt itself.
No comments:
Post a Comment