PHP Classes

File: doc/

Recommend this page to a friend!
  Classes of Xavier Pérez   XMongoDB   doc/   Download  
File: doc/
Role: Documentation
Content type: text/markdown
Description: Documentation
Class: XMongoDB
Build and execute queries to a MongoDB database
Author: By
Last change: Changes manual
Date: 8 years ago
Size: 3,108 bytes


Class file image Download

Advanced Select Operations

Where Options

Operators !=, <, >, <=, >=


Where Not Equal


Where Lower Than


Where Lower Or Equal Than


Where Greater Than


Where Greater Or Equal Than


Where In

Finds in 'myfield1' a set of possible values

$xmongodb->where_in('myfield1', array('value1','value2','value3'));

Where Not In

Finds in 'myfield1' where a set of possible values is not found

$xmongodb->where_not_in('myfield1', array('value1','value2','value3'));

Where Between

Finds in 'myfield1' between two values (including equal)

$xmongodb->where_between('myfield1', $x, $y);

For char dates

$xmongodb->where_between('mydate1', '2015-04-29 00:00:00', '2015-04-29 23:59:59');

For ISODates, must to be converted to ISODate

$xmongodb->where_between('mydate1', 'ISODate("2015-04-29T00:00:00.000Z")', 'ISODate("2015-04-29T23:59:59.000Z")');

Where Not Between

Finds in 'myfield1' between two values (not including equal)

$xmongodb->where_between_ne('myfield1', $x, $y);

Like Options


Normal Like

$xmongodb->like('myfield1', 'value1', $flags, $disable_start_wildcard , $disable_end_wildcard);


- flags:

* i = case insensitive (default)
* m = multiline
* x = can contain comments
* l = locale
* s = dotall, "." matches everything, including newlines
* u = match unicode

- disable_start_wildcard

* If TRUE a starting line character "^" will be prepended, default FALSE

- disable_end_wildcard

* If TRUE an ending line character "$" will be appended, default FALSE

Not Like

$xmongodb->not_like('myfield1', array('value1','value2','value3'));

Finds in 'myfield1' that not contains 'value1', 'value2' neither 'value3'

Other Options


Distinct can only select only one unique field or subdocument. If the field is a subdocument will return all different subdocuments.

Returns an array of distinct values.

// OR

Return an array of differentes 'myfield2' found.



Count all documents in a collection


Returns an integer

Count All Results

Count all documents in a collection using where, limit and offset


Returns an integer