Parse common mongodb query operations in PHP

Source: Internet
Author: User
Tags mongodb query

Copy codeThe Code is as follows: <? Php
// The delimiter string is
$ Querys = array ("name" => "shian ");

// Number of equal values
$ Querys = array ("number" => 7 );

// How much is the data size?
$ Querys = array ("number" => array ('$ gt' => 5 ));

// The value is equal to or greater
$ Querys = array ("number" => array ('$ gte' => 2 ));

// What is the value smaller
$ Querys = array ("number" => array ('$ lt' => 5 ));

// The number is less than equal
$ Querys = array ("number" => array ('$ lte' => 2 ));

// Number of data values
$ Querys = array ("number" => array ('$ gt' => 1, '$ lt' => 9 ));

// The data value is not equal to a value.
$ Querys = array ("number" => array ('$ nee' => 9 ));

// Use js to check the condition
$ Js = "function (){
Return this. number = 2 & this. name = 'shian ';
}";
$ Querys = array ('$ where' => $ js );

// Which values are equal to the memory bit?
$ Querys = array ("number" => array ('$ in' => array (1, 2, 9 )));

// Which values are not supported by the delimiter?
$ Querys = array ("number" => array ('$ nin' => array (, 9 )));

// Use the regular query statement
$ Querys = array ("name" => new MongoRegex ("/shi/$ I "));

// Or
$ Querys = array ('$ or' => array ('number' => 2), array ('number' => 9 )));
?>

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.