PHP Class MongoLite\Collection

Show file Open project: aheinze/mongo-lite

Public Properties

Property Type Description
$database Database
$name string

Public Methods

Method Description
__construct ( string $name, object $database ) Constructor
count ( mixed $criteria = null ) : integer Count documents in collections
drop ( ) Drop collection
find ( mixed $criteria = null, $projection = null ) : object Find documents
findOne ( mixed $criteria = null, $projection = null ) : array Find one document
insert ( array &$document ) : mixed Insert document
remove ( mixed $criteria ) : mixed Remove documents
renameCollection ( string $newname ) : boolean Rename Collection
save ( array &$document ) : mixed Save document
update ( mixed $criteria, array $data ) : integer Update documents

Protected Methods

Method Description
_insert ( array &$document ) : mixed Insert document

Method Details

__construct() public method

Constructor
public __construct ( string $name, object $database )
$name string
$database object

_insert() protected method

Insert document
protected _insert ( array &$document ) : mixed
$document array
return mixed

count() public method

Count documents in collections
public count ( mixed $criteria = null ) : integer
$criteria mixed
return integer

drop() public method

Drop collection
public drop ( )

find() public method

Find documents
public find ( mixed $criteria = null, $projection = null ) : object
$criteria mixed
return object Cursor

findOne() public method

Find one document
public findOne ( mixed $criteria = null, $projection = null ) : array
$criteria mixed
return array

insert() public method

Insert document
public insert ( array &$document ) : mixed
$document array
return mixed last_insert_id for single document or count count of inserted documents for arrays

remove() public method

Remove documents
public remove ( mixed $criteria ) : mixed
$criteria mixed
return mixed

renameCollection() public method

Rename Collection
public renameCollection ( string $newname ) : boolean
$newname string [description]
return boolean

save() public method

Save document
public save ( array &$document ) : mixed
$document array
return mixed

update() public method

Update documents
public update ( mixed $criteria, array $data ) : integer
$criteria mixed
$data array
return integer

Property Details

$database public property

Database
public $database

$name public property

public string $name
return string