Class 19 - Database Essentials - MongoDB

Class 19 - Database Essentials - MongoDB
0.0 0

#1

Originally published at: https://kaizen.itversity.com/topic/class-19-database-essentials-mongodb/


#2

To get the order_items.order_item_quantity =5 using the find query we can also use this
db.order_details.findOne({
“order_id”:2,
“order_items.order_item_quantity”:5 },
{
“order_id”:1,
“order_items.$.order_item_quantity”:1})
The trick here is to use the $ sign while entering to the array in Json. We also use combinations of 0 and $ if the array have more nesting.