Fundamentals of MongoDB

Categories Javascipt, NodeJs

So in my course about nodejs I´m working with MongoDB. So I decided to documented my new knowledge here. In this post, I´ll provide an overview of MongoDB and some of its key features.


What is MongoDB ?

It is a document-oriented database, not a relational one. Non relational means it does not store data in tables but in the form of JSON document. The primary reason for moving away from the relational model is to make scaling out easier. Here in MongoDB row is replaced with document and table is replaced with collection. It can be thought of as a group of documents.

mongodb-logo (1)

Document is the basic unit of data for MongoDB, roughly equivalent to a row. It is a data structure composed of field and value pairs.
MongoDB documents are similar to JSON objects. The values maybe documents, arrays, and arrays of documents.

Here is what we cover in this Post
  • DELETE
  • FIND
  • UPDATE

1. DELETE

We are going to cover three delete Methods whichs MongoDB provides.

  • deleteMany – Deletes every document where text is the queried one
  • deleteOne – Deletes every document where text is the queried one
  • findOneAndDelete – Finds the first document where completed is false and return/delete it

 

2. FIND

We are going to cover one delete Methods whichs MongoDB provides:

  • find – Gets all todos and can be filtered
  • findOne – takes first argument as a query string

 

3. UPDATE

We are going to cover one delete Methods whichs MongoDB provides :

  • findOneAndUpdate – Its the same as findOneAndDelete but this time we update a Document so me mus provide Information which attributes should get updated


I got to know these methods in my course, I hope you have no an understanding overview about MongoDB and its Methods.

Greetings

Moritz 😀

Leave a Reply

Your email address will not be published. Required fields are marked *