Code Monkey home page Code Monkey logo

mongodb_task1's Introduction

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: { $gt: 1 } } } ]).map(val=> db.collection.deleteMany({"product_price": val._id.product_price}))

mongodb_task1's People

Contributors

raghava20 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.