Skip to content

Commit

Permalink
Create README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
raghava20 authored Dec 25, 2021
0 parents commit 8396e6d
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
## mongodb_task
1.Find all the information about each products

db.collection.find({})

2.Find the product price which are between 400 to 800

db.collection.find({ product_price: { $gte: 400, $lte: 800 }})

3.Find the product price which are not between 400 to 600

db.collection.find({ product_price: { "$not": { $gte: 400, $lte: 800 } }})

4.List the four product which are grater than 500 in price

db.collection.find({"product_price": {"$gte": 500}}).limit(4)

5.Find the product name and product material of each products

db.collection.find({},{ product_name: 1, product_material: 1})

6.Find the product with a row id of 10

db.collection.find({id: "10"})

7.Find only the product name and product material

db.collection.find({},{ product_name: 1, product_material: 1})

8.Find all products which contain the value of soft in product material

db.collection.find({product_material: { "$eq": "Soft" }})

9.Find products which contain product color indigo and product price 492.00

db.collection.find({ "$or": [{product_color: "indigo" },{product_price: 492.00 }]})

10.Delete the products which product price value are same

db.collection.aggregate([ {"$group": {"_id": {product_price: "$product_price"},total: {$sum: 1 } } },{$match: {total: 2 } }]).deleteMany()

0 comments on commit 8396e6d

Please sign in to comment.