PHP Class PHPDaemon\Clients\Mongo\Collection

Author: Vasily Zorin ([email protected])
Inheritance: use trait PHPDaemon\Traits\ClassWatchdog, use trait PHPDaemon\Traits\StaticObjectWatchdog
Mostrar archivo Open project: kakserpom/phpdaemon Class Usage Examples

Public Properties

Property Type Description
$name Name of collection
$pool Related Pool object

Public Methods

Method Description
__construct ( string $name, Pool $pool ) : void Contructor of MongoClientAsyncCollection
aggregate ( array $p, callable $cb ) : void Aggregate
autoincrement ( callable $cb, boolean $plain = false ) : void Generation autoincrement
count ( callable $cb, array $p = [] ) : void Counts objects in collection
ensureIndex ( array $keys, array $options = [], callable $cb = null ) : void Ensure index
evaluate ( string $code, callable $cb ) : void Evaluates a code on the server side
find ( callable $cb, array $p = [] ) : void Finds objects in collection
findAll ( callable $cb, array $p = [] ) : void Finds objects in collection and fires callback when got all objects
findAndModify ( array $p, callable $cb ) : void Generation autoincrement
findOne ( callable $cb, array $p = [] ) : void Finds one object in collection
group ( callable $cb, array $p = [] ) : void Groupping function
insert ( array $doc, callable $cb = null, array $params = null ) : MongoId Inserts an object
insertMulti ( array $docs, callable $cb = null, array $params = null ) : array Inserts several documents
insertOne ( array $doc, callable $cb = null, array $params = null ) : MongoId Inserts an object
remove ( array $cond = [], callable $cb = null, array $params = null ) : void Removes objects from collection
update ( array $cond, array $data, integer $flags, callable $cb = null, array $params = null ) : void Updates one object in collection
updateMulti ( array $cond, array $data, callable $cb = null, array $params = null ) : void Updates one object in collection
updateOne ( array $cond, array $data, callable $cb = null, array $params = null ) : void Updates one object in collection
upsert ( array $cond, array $data, boolean $multi = false, callable $cb = null, array $params = null ) : void Upserts an object (updates if exists, insert if not exists)
upsertMulti ( array $cond, array $data, callable $cb = null, array $params = null ) : void Upserts an object (updates if exists, insert if not exists)
upsertOne ( array $cond, array $data, callable $cb = null, array $params = null ) : void Upserts an object (updates if exists, insert if not exists)

Method Details

__construct() public method

Contructor of MongoClientAsyncCollection
public __construct ( string $name, Pool $pool ) : void
$name string Name of collection
$pool Pool Pool
return void

aggregate() public method

Aggregate
public aggregate ( array $p, callable $cb ) : void
$p array Params
$cb callable Callback called when response received
return void

autoincrement() public method

Generation autoincrement
public autoincrement ( callable $cb, boolean $plain = false ) : void
$cb callable Called when response received
$plain boolean Plain?
return void

count() public method

Counts objects in collection
public count ( callable $cb, array $p = [] ) : void
$cb callable Callback called when response received
$p array Hash of properties (offset, limit, opts, where, col)
return void

ensureIndex() public method

Ensure index
public ensureIndex ( array $keys, array $options = [], callable $cb = null ) : void
$keys array Keys
$options array Optional. Options
$cb callable Optional. Callback called when response received
return void

evaluate() public method

Evaluates a code on the server side
public evaluate ( string $code, callable $cb ) : void
$code string Code
$cb callable Callback called when response received
return void

find() public method

Finds objects in collection
public find ( callable $cb, array $p = [] ) : void
$cb callable Callback called when response received
$p array Hash of properties (offset, limit, opts, tailable, where, col, fields, sort, hint, explain, snapshot, orderby, parse_oplog)
return void

findAll() public method

Finds objects in collection and fires callback when got all objects
public findAll ( callable $cb, array $p = [] ) : void
$cb callable Callback called when response received
$p array Hash of properties (offset, limit, opts, tailable, where, col, fields, sort, hint, explain, snapshot, orderby, parse_oplog)
return void

findAndModify() public method

Generation autoincrement
public findAndModify ( array $p, callable $cb ) : void
$p array Params
$cb callable Callback called when response received
return void

findOne() public method

Finds one object in collection
public findOne ( callable $cb, array $p = [] ) : void
$cb callable Callback called when response received
$p array Hash of properties (offset, opts, where, col, fields, sort, hint, explain, snapshot, orderby, parse_oplog)
return void

group() public method

Groupping function
public group ( callable $cb, array $p = [] ) : void
$cb callable Callback called when response received
$p array Hash of properties (offset, limit, opts, key, col, reduce, initial)
return void

insert() public method

Inserts an object
public insert ( array $doc, callable $cb = null, array $params = null ) : MongoId
$doc array Data
$cb callable Optional. Callback called when response received
$params array Optional. Params
return MongoId

insertMulti() public method

Inserts several documents
public insertMulti ( array $docs, callable $cb = null, array $params = null ) : array
$docs array Array of docs
$cb callable Optional. Callback called when response received.
$params array Optional. Params
return array IDs

insertOne() public method

Inserts an object
public insertOne ( array $doc, callable $cb = null, array $params = null ) : MongoId
$doc array Data
$cb callable Optional. Callback called when response received
$params array Optional. Params
return MongoId

remove() public method

Removes objects from collection
public remove ( array $cond = [], callable $cb = null, array $params = null ) : void
$cond array Conditions
$cb callable Optional. Callback called when response received
$params array Optional. Params
return void

update() public method

Updates one object in collection
public update ( array $cond, array $data, integer $flags, callable $cb = null, array $params = null ) : void
$cond array Conditions
$data array Data
$flags integer Optional. Flags
$cb callable Optional. Callback called when response received
$params array Optional. Params
return void

updateMulti() public method

Updates one object in collection
public updateMulti ( array $cond, array $data, callable $cb = null, array $params = null ) : void
$cond array Conditions
$data array Data
$cb callable Optional. Callback called when response received
$params array Optional. Params
return void

updateOne() public method

Updates one object in collection
public updateOne ( array $cond, array $data, callable $cb = null, array $params = null ) : void
$cond array Conditions
$data array Data
$cb callable Optional. Callback called when response received
$params array Optional. Params
return void

upsert() public method

Upserts an object (updates if exists, insert if not exists)
public upsert ( array $cond, array $data, boolean $multi = false, callable $cb = null, array $params = null ) : void
$cond array Conditions
$data array Data
$multi boolean Optional. Multi-flag
$cb callable Optional. Callback called when response received
$params array Optional. Params
return void

upsertMulti() public method

Upserts an object (updates if exists, insert if not exists)
public upsertMulti ( array $cond, array $data, callable $cb = null, array $params = null ) : void
$cond array Conditions
$data array Data
$cb callable Optional. Callback called when response received
$params array Optional. Params
return void

upsertOne() public method

Upserts an object (updates if exists, insert if not exists)
public upsertOne ( array $cond, array $data, callable $cb = null, array $params = null ) : void
$cond array Conditions
$data array Data
$cb callable Optional. Callback called when response received
$params array Optional. Params
return void

Property Details

$name public_oe property

Name of collection
public $name

$pool public_oe property

Related Pool object
public $pool