Collection
class Collection (View source)
Class Collection
Methods
Collection constructor
Add collection document
Add or replace collection document
Get document count
Create collection index
Drop collection index
Check if collection exists in database
No description
Get collection name
Get one document This is a shortcut for Collection.find("_id = :id").bind("id", id).execute().fetchOne();.
Get a new Session object from the Collection object.
Modify collections that meet specific search conditions. Multiple operations are allowed, and parameter binding is supported.
Remove collections that meet specific search conditions. Multiple operations are allowed, and parameter binding is supported.
Remove one collection document Remove one document from the collection with the corresponding ID. This is a shortcut for Collection.remove("_id = :id").bind("id", id).execute().
Updates (or replaces) the document identified by ID, if it exists.
Details
__construct()
Collection constructor
CollectionAdd
add(mixed $document)
Add collection document
Result
addOrReplaceOne(string $id, mixed $document)
Add or replace collection document
int
count()
Get document count
createIndex(string $index_name, string $index_desc_json)
Create collection index
bool
dropIndex(string $index_name)
Drop collection index
bool
existsInDatabase()
Check if collection exists in database
CollectionFind
find(string $search_condition)
No description
string
getName()
Get collection name
mixed
getOne(string $id)
Get one document This is a shortcut for Collection.find("_id = :id").bind("id", id).execute().fetchOne();.
Schema
getSchema()
Retrieve the schema object that contains the collection.
Session
getSession()
Get a new Session object from the Collection object.
CollectionModify
modify(string $search_condition)
Modify collections that meet specific search conditions. Multiple operations are allowed, and parameter binding is supported.
CollectionRemove
remove(string $search_condition)
Remove collections that meet specific search conditions. Multiple operations are allowed, and parameter binding is supported.
Result
removeOne(string $id)
Remove one collection document Remove one document from the collection with the corresponding ID. This is a shortcut for Collection.remove("_id = :id").bind("id", id).execute().
Result
replaceOne(string $id, string $doc)
Updates (or replaces) the document identified by ID, if it exists.