25
loading...
This website collects cookies to deliver better user experience
mongod --version
into your command line once you've finished the installation procedure. You should receive anything along these lines:mongod --version
mongo --version
mongod
command.27017
mongod
mongod
window running when you want to work with your local MongoDB. MongoDB stops when you close the windowTerminology | Description |
---|---|
field | A name-value pair. It is similar concept of column of an RDBMS |
document | A group of fields are termed as document. In RDBMS we will term it as row. MongoDB document follows JSON syntax but it is a BSON syntax (BSON is an extended version of JSON implemented by MongoDB). |
collection | A group of documents is called collection in MongoDB. A collection is similar concept of table of an RDBMS. |
database | A Physical Container for Collections. Each database gets its own set of files on the file system. A single MongoDB server typically has multiple databases |
SQL Terms | MongoDB Terms |
---|---|
database | database |
table | collection |
row | document or BSON document |
column | field |
Index | Index |
table joins | embedded documents and linking |
primary key.Specify any unique column or column combination as primary key. | primary key.In MongoDB, the primary key is automatically set to the _id field. |
aggregation (e.g. group by) | aggregation pipeline |
SQL Concepts | MongoDB Aggregation Operators |
---|---|
WHERE | $match |
GROUP BY | $group |
HAVING | $match |
SELECT | $project |
ORDER BY | $sort |
LIMIT | $limit |
SUM() | $sum |
COUNT() | $sum |
join | $lookup |
mongo
.mongo
Note: Make sure you keep the mongod window open! You won't be able to interact with the Mongo Shell if you close the mongod window.
> db
Note: The > in the code above signifies the Mongo Shell. You don't need to type >. It is not part of the command.
tweety
. You can use the use <database>
command to create and switch to a new database.use tweety
db.users.insertOne({ firstName:"Christopher",
lastName:"Glikpo"
});
db.users.insertOne({ firstName:"Ben",
lastName:"Attoh"
});
db.characters.find();