Find In MongoDB: 13 Things You Must Know | Find Method To Query Document

preview_player
Показать описание
In this tutorial, you'll learn how to use the find method in MongoDB.



Video Transcript:

Hi guys, this is Abhi from Gokcedb. In this video, you're going to learn 13 ways to use the find method in the MongoDB database. Number one, you can use the find method with empty parentheses to select all the documents from a collection.

Here I'm returning all the properties in the properties collection. Number two, finding one method will only return one document. Number three, say I wanted to return all the properties where the size acres is less than five.

To do that, I'll use the LTE operator. Number four, use the LTE operator to return all the properties that are less than equal to 5. Similarly, use GT and GTE operators for greater than and greater than equal to respectively.

Number seven, to select all the properties where the size in acres is not equal to five. Use the NE operators. Number eight, to find all the properties where the attributes field contains either water or solar use the IN operator.

Similarly, you can use the NIN operator for the not-in condition number ten, or use the END operator for an END condition. In this example, I'm selecting all the properties which have the attributes of water and the attributes of solar. Number eleven, use the OR operator for an OR condition.

Here I'm selecting all the properties with the attributes of solar or the size in acres is greater than 4. Number twelve, you can also make use of the NOR operator. In this example, I'm selecting all the properties where the subdivision is not Rio Rancho nor the county is Jefferson. Last but not the least number thirteen.

In this example, I'm selecting all the properties where the subdivision is not equal to Rancho Rio. There you have it. Make sure you like, subscribe, and turn on the notification bell. Until next.



Рекомендации по теме
Комментарии
Автор

Good, I'm trying to follow through

justineimasiku