Mittwoch, 18. Mai, 2016
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
MongoDB CRUD the MVC way with Passport Authentication 49<br />
Let’s query the MongoDB via terminal<br />
batman<br />
MongoDB shell (mongo.exe on Windows machine, mongo binary on Linux) will automatically<br />
connect to the default test database if you run it without any parameters. In order to switch to<br />
another database (in this example called todos) execute the following command:<br />
1 use todos<br />
Databases and collections are lazily created when you insert your first document, which means that<br />
if you use the use todos command from above, but you don’t insert any documents, the database<br />
will not be created.<br />
In order to show all the available databases execute the following command:<br />
1 show dbs<br />
A MongoDB collection is a list of MongoDB documents and is the equivalent of a<br />
relational database table. Unlike a table, a collection doesn’t enforce any type of schema. To show<br />
all available collections in the database execute:<br />
1 show collections