DEV Community

MMK2020
MMK2020

Posted on

Something short about MongoDB

I have worked with relational databases particularly MySQL and later on MariaDB.

So recently I decided to check out MongoDB and test the NoSQL world for a bit. Still there is much for me to learn.

MongoDB is a NoSQL, document oriented, cross platform database program. MongoDB uses JSON-like (Binary JSON - BSON) documents with optional schemas. Apparently the word MongoDB is derived from two words Humongous Database

NoSQL databases store data differently than relational tables, specifically they don’t have tables.

MongoDB stores data records as documents (specifically BSON documents) which are gathered together in collections. A database stores one or more collections of documents. Collections are analogous to tables in relational databases.

According to Wikipedia MongoDB comes in three editions MongoDB Community Server, MongoDB Enterprise Server and MongoDB Atlas

MongoDB Community Server
The MongoDB Community Edition is free and available for Windows, Linux, and macOS.

MongoDB Enterprise Server
MongoDB Enterprise Server is the commercial edition of MongoDB, available as part of the MongoDB Enterprise Advanced subscription.

MongoDB Atlas
MongoDB is also available as an on-demand fully managed service. MongoDB Atlas runs on AWS, Microsoft Azure, and Google Cloud Platform.

Restrictions on Database names
Database names are case-sensitive in MongoDB but they must also differ on more than just case otherwise you will get an error.
Database names for deployments running on Windows systems cannot contain any of the following characters: /. "$*<>:|? While those deployed on Linux/Unix systems cannot contain any of the following characters: /. "$
Database names cannot be empty and must have fewer than 64 characters.

Restriction on Collection Names
Collection names should begin with an underscore or a letter character, and cannot: contain the $, be an empty string, contain the null character, and begin with the system prefix.

Restrictions on Field Names
Field names cannot contain the null character.
The field name _id is reserved for use as a primary key; its value must be unique in the collection, is immutable, and may be of any type other than an array. If the _id contains subfields, the subfield names cannot begin with a ($) symbol.

The MongoDB Shell a.k.a mongosh is an interactive environment for interacting with MongoDB deployments, from here you can issue commands to query and interact with your database.

References
https://www.mongodb.com/docs
https://en.wikipedia.org/wiki/MongoDB

Top comments (0)