Practice: Insert and Find Operations · MongoDB
Ch 2 · MongoDB CRUD Operations — card 3 of 8.
Practise inserting and querying a small product catalogue. You will add five products, each with a name, price and category, then find the ones costing more than 50 and count how many belong to one category. A correct answer shows you can write a filter object, use a comparison operator, and remember that find returns a cursor rather than an array.
- Insert 5 product documents
- Find products over a certain price
- Count products in a category
// Assume collection is ready // Insert 5 products with name, price, category // Find expensive products (price > 50) // Count electronics