Some common query methods of MongoDB _mongodb

Source: Internet
Author: User
Tags mongodb
Query.all ("name", "a", "B"), or multiple elements to match array
Query.and (Query.eq ("name", "a"), Query.eq ("title", "T"));//satisfy multiple conditions simultaneously
query.eq ("name", "a");/=
Query.exists ("type", true);//Determine whether the key value exists
query.gt ("value", 2);//greater Than >
Query.gte ("value", 3);/greater than or equal to >=
query.in ("name", "a", "B");//Includes all values specified, you can specify different types of conditions and values
query.lt ("value", 9);//Less than <
Query.lte ("value", 8);//less than equal to <=
query.mod ("Value", 3, 1);//Divide the query value by the first given value, Returns the result
query.ne ("name", "C") if the remainder equals the second given value;//Not Equal
to Query.nor (array);/does not include the value in the array
query.not ("name"); Element Conditional Statement
query.notin ("name", "a", 2)//Returns the document
Query.or (Query.eq ("name", "a"), Query.eq ("title") that does not match all the conditions in the array. "T")//satisfies one of the conditions
query.size ("name", 2);//The length of the given key
Query.type ("_id", bsontype.objectid);//The type
of the given key Query.where (Bsonjavascript)//execute JavaScript
query.matches ("Title", str);//fuzzy query is equivalent to like in SQL--STR can contain regular expressions

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.