Some symbols in mongodb

Source: Internet
Author: User
Some symbols in mongodb greater than: $ gt greater than or equal to: $ gte less than: $ lt less than or equal to: $ lte not equal to: $ neIN: $ inNOTIN: $ nin remainder: $ mod not: $ not or: $ OR Example 1: Query persons of the age of 20 and 30 in XXX: [javascript] db. XXX. find ({age :{$ gt: 20, lte: 30}); Example 2: query the age in XXX

Some symbols IN mongodb greater than: $ gt greater than or equal to: $ gte less than: $ lt less than or equal to: $ lte NOT equal to: $ ne in: $ in not in: $ nin remainder: $ mod: $ not or: $ OR Example 1: Query persons of the age of 20 and = 30 in XXX: [javascript] db. XXX. find ({age :{$ gt: 20, lte: 30}); Example 2: query the age in XXX

Some symbols in mongodb

Greater than: $ gt

Greater than or equal to: $ gte

Less than: $ lt

Less than or equal to: $ lte

Not equal to: $ ne

IN: $ in

Not in: $ nin

Remainder: $ mod

Non: $ NOT

OR: $ OR

Example 1: query the persons whose age is greater than 20 and <= 30 in XXX:

[Javascript]

Db. XXX. find ({"age": {"$ gt": 20, "lte": 30 }});

Example 2: Query persons of different ages in XXX:

[Javascript]

Db. XXX. find ({"age": {"$ ne": 20 }});

Example 3: A person named BuleRiver OR BuleRiver2. Do not use OR

[Javascript]

Db. XXX. find ({"name": {"$ in": ["BuleRiver", "BuleRiver2"]});

Example 4: All persons whose age MOD5 is 3 or not 3:

[Javascript]

Db. XXX. find ({"age": {"$ mod": [5, 3]});

Db. XXX. find ({"age": {"$ not": {"$ mod": [5, 3] }});

Example 5: Use OR to implement Example 3

[Javascript]

Db. XXX. find ({"$ OR": [{"name": "BuleRiver" },{ "name": "BuleRiver2"}]});

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.