PHP Class Shanty_Mongo_Collection

Author: Coen Hyde
Afficher le fichier Open project: coen-hyde/shanty-mongo Class Usage Examples

Protected Properties

Свойство Type Description
$_cachedCollectionInheritance
$_cachedCollectionRequirements
$_collection
$_connectionGroup
$_db
$_documentSetClass
$_requirements

Méthodes publiques

Méthode Description
all ( array $query = [], array $fields = [] ) : Shanty_Mongo_Iterator_Cursor Find many documents
create ( array $data = [], boolean $new = true ) Create a new document belonging to this collection
deleteIndex ( string | array $keys ) Delete an index
deleteIndexes ( ) Remove all indexes from this collection
distinct ( String $property, $query = [] ) : array Select distinct values for a property
drop ( ) Drop this collection
ensureIndex ( array $keys, array $options = [] ) Ensure an index
fetchAll ( array $query = [], array $fields = [] ) : Shanty_Mongo_Iterator_Cursor Alias for all
fetchOne ( array $query = [], array $fields = [] ) : Shanty_Mongo_Document Alias for one
find ( MongoId | String $id, array $fields = [] ) : Shanty_Mongo_Document Find a document by id
getCollectionInheritance ( ) Get the inheritance of this collection
getCollectionName ( ) : string Get the name of the mongo collection
getCollectionRequirements ( bolean $inherited = true ) : array Get requirements
getConnection ( $writable = true ) * Get a connection
getConnectionGroupName ( ) : string Get the name of the connection group
getDbName ( ) : string Get the name of the mongo db
getDocumentClass ( ) : string Get the name of the document class
getDocumentSetClass ( ) : string Get the name of the document set class
getIndexInfo ( ) : array Get index information for this collection
getMongoCollection ( $writable = true ) : MongoCollection Get an instance of MongoCollection
getMongoDb ( $writable = true ) : MongoDb Get an instance of MongoDb
hasCollectionName ( ) : boolean Determine if this collection has a collection name set
hasDbName ( ) : boolean Determine if this collection has a database name set
insert ( array $document, array $options = [] ) Insert a document
insertBatch ( array $documents, array $options = [] ) Insert a batch of documents
isDocumentClass ( ) : boolean Is this class a document class
makeRequirementsTidy ( array $requirements ) : array Process requirements to make sure they are in the correct format
mergeRequirements ( $requirements1, $requirements2 ) : array Merge a two sets of requirements together
one ( array $query = [], array $fields = [] ) : Shanty_Mongo_Document Find one document
remove ( array $criteria, array $options = [] ) Remove documents from this collection
update ( array $criteria, array $object, array $options = [] ) Update documents from this collection

Method Details

all() public static méthode

Find many documents
public static all ( array $query = [], array $fields = [] ) : Shanty_Mongo_Iterator_Cursor
$query array
$fields array
Résultat Shanty_Mongo_Iterator_Cursor

create() public static méthode

Create a new document belonging to this collection
public static create ( array $data = [], boolean $new = true )
$data array
$new boolean

deleteIndex() public static méthode

Delete an index
public static deleteIndex ( string | array $keys )
$keys string | array

deleteIndexes() public static méthode

Remove all indexes from this collection
public static deleteIndexes ( )

distinct() public static méthode

Select distinct values for a property
public static distinct ( String $property, $query = [] ) : array
$property String
Résultat array

drop() public static méthode

Drop this collection
public static drop ( )

ensureIndex() public static méthode

Ensure an index
public static ensureIndex ( array $keys, array $options = [] )
$keys array
$options array

fetchAll() public static méthode

Alias for all
public static fetchAll ( array $query = [], array $fields = [] ) : Shanty_Mongo_Iterator_Cursor
$query array
$fields array
Résultat Shanty_Mongo_Iterator_Cursor

fetchOne() public static méthode

Alias for one
public static fetchOne ( array $query = [], array $fields = [] ) : Shanty_Mongo_Document
$query array
$fields array
Résultat Shanty_Mongo_Document

find() public static méthode

Find a document by id
public static find ( MongoId | String $id, array $fields = [] ) : Shanty_Mongo_Document
$id MongoId | String
$fields array
Résultat Shanty_Mongo_Document

getCollectionInheritance() public static méthode

Get the inheritance of this collection
public static getCollectionInheritance ( )

getCollectionName() public static méthode

Get the name of the mongo collection
public static getCollectionName ( ) : string
Résultat string

getCollectionRequirements() public static méthode

Get requirements
public static getCollectionRequirements ( bolean $inherited = true ) : array
$inherited bolean Include inherited requirements
Résultat array

getConnection() public static méthode

* Get a connection
public static getConnection ( $writable = true )
$writable should the connection be writable

getConnectionGroupName() public static méthode

Get the name of the connection group
public static getConnectionGroupName ( ) : string
Résultat string

getDbName() public static méthode

Get the name of the mongo db
public static getDbName ( ) : string
Résultat string

getDocumentClass() public static méthode

Get the name of the document class
public static getDocumentClass ( ) : string
Résultat string

getDocumentSetClass() public static méthode

Get the name of the document set class
public static getDocumentSetClass ( ) : string
Résultat string

getIndexInfo() public static méthode

Get index information for this collection
public static getIndexInfo ( ) : array
Résultat array

getMongoCollection() public static méthode

Get an instance of MongoCollection
public static getMongoCollection ( $writable = true ) : MongoCollection
Résultat MongoCollection

getMongoDb() public static méthode

Get an instance of MongoDb
public static getMongoDb ( $writable = true ) : MongoDb
Résultat MongoDb

hasCollectionName() public static méthode

Determine if this collection has a collection name set
public static hasCollectionName ( ) : boolean
Résultat boolean

hasDbName() public static méthode

Determine if this collection has a database name set
public static hasDbName ( ) : boolean
Résultat boolean

insert() public static méthode

Insert a document
public static insert ( array $document, array $options = [] )
$document array
$options array

insertBatch() public static méthode

Insert a batch of documents
public static insertBatch ( array $documents, array $options = [] )
$documents array
$options array

isDocumentClass() public static méthode

Is this class a document class
public static isDocumentClass ( ) : boolean
Résultat boolean

makeRequirementsTidy() public static méthode

Process requirements to make sure they are in the correct format
public static makeRequirementsTidy ( array $requirements ) : array
$requirements array
Résultat array

mergeRequirements() public static méthode

Merge a two sets of requirements together
public static mergeRequirements ( $requirements1, $requirements2 ) : array
Résultat array

one() public static méthode

Find one document
public static one ( array $query = [], array $fields = [] ) : Shanty_Mongo_Document
$query array
$fields array
Résultat Shanty_Mongo_Document

remove() public static méthode

Remove documents from this collection
public static remove ( array $criteria, array $options = [] )
$criteria array
$options array

update() public static méthode

Update documents from this collection
public static update ( array $criteria, array $object, array $options = [] )
$criteria array
$object array
$options array

Property Details

$_cachedCollectionInheritance protected_oe static_oe property

protected static $_cachedCollectionInheritance

$_cachedCollectionRequirements protected_oe static_oe property

protected static $_cachedCollectionRequirements

$_collection protected_oe static_oe property

protected static $_collection

$_connectionGroup protected_oe static_oe property

protected static $_connectionGroup

$_db protected_oe static_oe property

protected static $_db

$_documentSetClass protected_oe static_oe property

protected static $_documentSetClass

$_requirements protected_oe static_oe property

protected static $_requirements