MongoDB find documents within two dates

MongoDB with date : We have one collection with the below documents : db.items.insertMany( [{ name : “one”, date : new Date(“2019-01-01”) }, { name : “two”, date : new Date(“2019-02-01”) }, { name : “three”, date : new Date(“2019-03-01”) }, { name : “four”, date : new Date(“2019-04-01”) }, Read more…

MongoDB find() method introduction

Introduction to find() method in MongoDB : The find() method in MongoDB is used to search documents in a collection. You can get all the documents in a collection using this method based on the condition that you are providing. It takes two optional parameters : query projection query is Read more…

MongoDB how to sort documents

How to sort documents in MongoDB

Introduction : We can easily sort the documents before retrieving them from a collection in MongoDB. Sorting is one of the important functionality that we should be aware of. In this tutorial, I will show you how to sort documents with a query.   Definition : The sort method is Read more…