$maxTimeMS in MongoDB
$maxTimeMS is used to specify the maximum time in which the query should be executed. $maxTimeMS operator is deprecated instead of maxTimeMs() is used. Time is specified in millisecond with integral value and it should be in the range of [0 , 2147483647].
Syntax:
db.collection_name.find().maxTimeMs(mention maximum time);
Example : Use maxTimeMS() method
Query:
db.Digits.find().maxTimeMS(100);
Output:
Explanation: In the above example,Digits collections is used to store the documents.Documents are requested using find() and maxTimeMS() methods. maxTimeMS() is used to specify the maximum time in which the query should be executed.
Query Modifiers in MongoDB
MongoDB was released in February 2009. It is an open-source document-oriented database and is classified as a NoSQL database. It follows the CAP theorem (Consistency Availability and Partition tolerance). It provides built-in support for the Sharding and replication. To ensure security MongoDB provides access control, authentication mechanism, and encryption.
MongoDB stores the records in a document in BSON format. It is an unstructured language and provides horizontal scalability and high-performance, data persistence. It follows the BASE ( Basically Available, Soft State, and Eventual Consistency )properties. It is used to handle big data faster than RDBMS.
In this article, we will learn about Query Modifiers in MongoDB along with the syntax and multiple Modifiers in MongoDB and so on.