Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint
Cover Image
Cover Image
Drag to reposition
Contributed Answers

How to find all objects created before specified Date in MongoDB?

Answered on 2nd May, 2019, 0 Views

You can use $lt operator for this. Let us create a collection with documents − , Display all documents from a collection with the help of find() method. The query is as follows − , This will produce the following output − , Following is the query to find all objects created before specified date − , This will produce the following output − ,

MongoDB query to remove item from array?

Answered on 30th Apr, 2019, 0 Views

To remove item from array, you can use $pull operator. Let us create a collection with documents − , Display all documents from a collection with the help of find() method. The query is as follows − , This will produce the following output − , Following is the query to remove item from an array − , In the above query, we have removed “Java”. Let us now di.....

How can I save new Date() in MongoDB?

Answered on 30th Apr, 2019, 0 Views

To save new Date() in MongoDB, you can use new ISODate(). Let us create a collection with documents − , Display all documents from a collection with the help of find() method − , This will produce the following output − ,

Count distinct value in MongoDB?

Answered on 30th Apr, 2019, 0 Views

Use the concept of length to count distinct value. Following is the syntax − , Let us create a collection with documents − , Display all documents from a collection with the help of find() method − , This will produce the following output − , Following is the query to count distinct value − , This will produce the following output − ,

Get index of given element in array field in MongoDB?

Answered on 30th Apr, 2019, 0 Views

You can use $indexOfArray operator for this. Let us create a collection with documents − , Display all documents from a collection with the help of find() method − , This will produce the following output − , Following is the query to get index of given element in an array field in MongoDB − , This will produce the following output − , Following is the query to.....

Unset an attribute from a single array element in MongoDB?

Answered on 30th Apr, 2019, 0 Views

Use $unset operator to unset an attribute. Let us first create a collection with documents − , Following is the query to display all documents from the collection with the help of find() method − , This will produce the following output − , Following is the query to unset an attribute from a single array element. The attribute “StudentCountryName” with value &l.....

MongoDB query to find the highest numeric value of a column?

Answered on 30th Apr, 2019, 0 Views

You can use $not operator along with $type for this. Let us first create a collection with documents − , Following is the query to display all documents from the collection with the help of find() method − , This will produce the following output − , Following is the query to find the highest numeric value of a column − , This will produce the following output &minus.....

How to read a specific key-value pair from a MongoDB collection?

Answered on 30th Apr, 2019, 0 Views

You can use dot(.) notation to read a specific key-value pair from MongoDB collection. Let us first create a collection with documents − , Following is the query to display all documents from the collection with the help of find() method − , This will produce the following output − , Following is the query to read a specific key-value pair from a MongoDB collection −.....

How to remove duplicate values inside a list in MongoDB?

Answered on 30th Apr, 2019, 0 Views

You can use aggregate framework along with $setUnion operator. Let us first create a collection with documents − , Following is the query to display all documents from the collection with the help of find() method − , This will produce the following output − , Following is the query to remove duplicate values inside a list in MongoDB − , This will produce the followi.....

Extract subarray value in MongoDB?

Answered on 30th Apr, 2019, 0 Views

To extract the subarray value in MongoDB, you can use $elemMatch projection operator. Let us first create a collection with documents − , Following is the query to display all documents from the collection with the help of find() method − , This will produce the following output − , Following is the query to extract subarray value in MongoDB − , This will produce the.....

Previous 1 ... 3 4 5 6 7 8 9 ... 253 Next
loader
Advertisements
Contribution

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.