MongoDB's Find usage

Source: Internet
Author: User

1. Returns the specified key value: Db.list.find ({condition},{name: "Any value", Age: Any value}); The result will only return the _ID name age three key values, if you do not want to _id you need to write _id:0 explicitly to the second set of key values;

2. Specify the range of values for the key to return the specified key value: Db.list.find ({age:{$gte: 4, $lte: 25}},{name: "Any value", Age: Any value, _id:0}); Results filter out key values that are older than 4 or less than 25 and contain only name age;

3. A value of the shaving key returns the specified key value: Db.list.find ({age:{$ne: 14},{name: "1", age:2,_id:0}), and the result filters out the record with age 14 and the key value and contains only name ages;

MongoDB's Find usage

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.