MongoDB Basics: Chapter 4: Advanced CRUD Operations - Array Operators


No Action
1
MongoDB Basics: Chapter 4: Advanced CRUD Operations - Array Operators

0 comment

21 December 2020, 9:27 am by antelove19

MongoDB Basics: Chapter 4: Advanced CRUD Operations - Array Operators
MongoDB Basics: Chapter 4: Advanced CRUD Operations - Array Operators

To learn more about all available update operators in MQL, visit our excellent documentation page. This lesson used the following commands: Connect to the Atlas cluster: ```javascript mongo "mongodb+srv://:@.mongodb.net/admin" ```
Switch to this database: ```javascript use sample_airbnb ```
Find all documents with exactly 20 amenities which include all the amenities listed in the query array: ```javascript db.listingsAndReviews.find({ "amenities": { "$size": 20, "$all": [ "Internet", "Wifi", "Kitchen", "Heating", "Family/kid friendly", "Washer", "Dryer", "Essentials", "Shampoo", "Hangers", "Hair dryer", "Iron", "Laptop friendly workspace" ] } }).pretty() ```

Keywords:



Sources:

  1. university.mongodb.com