The MongoCollection class
(PECL mongo >=0.9.0)
简介
Represents a MongoDB collection.
Collection names can use any character in the ASCII set. Some valid
collection names are "", "...",
"my collection", and "*&#@".
User-defined collection names cannot contain the $ symbol. There are
certain system collections which use a $ in their names (e.g.,
local.oplog.$main), but it is a reserved character. If you attempt to
create and use a collection with a $ in the name, MongoDB will assert.
类摘要
MongoCollection
{
public array aggregate
(
array $pipeline
[,
array $options
] )
public MongoCommandCursor aggregateCursor
(
array $command
[,
array $options
] )
public mixed batchInsert
(
array $a
[,
array $options
= array()
] )
public int count
([
array $query
= array()
[,
int $limit
= 0
[,
int $skip
= 0
]]] )
public bool createIndex
(
array $keys
[,
array $options
= array()
] )
public array distinct
(
string $key
[,
array $query
] )
public array drop
(
void
)
public bool ensureIndex
(
string|array $key|keys
[,
array $options
= array()
] )
public MongoCursor find
([
array $query
= array()
[,
array $fields
= array()
]] )
public array findAndModify
(
array $query
[,
array $update
[,
array $fields
[,
array $options
]]] )
public array findOne
([
array $query
= array()
[,
array $fields
= array()
[,
array $options
= array()
]]] )
public MongoCollection __get
(
string $name
)
public array group
(
mixed $keys
,
array $initial
,
MongoCode $reduce
[,
array $options
= array()
] )
public bool|array remove
([
array $criteria
= array()
[,
array $options
= array()
]] )
public bool|array update
(
array $criteria
,
array $new_object
[,
array $options
= array()
] )
public array validate
([
bool $scan_data
= FALSE
] )
}
预定义常量
MongoCollection::ASCENDING
-
1
-
Ascending direction for sorts and index creation.
MongoCollection::DESCENDING
-
-1
-
Descending direction for sorts and index creation.
Fields
- db
-
The "parent" database for this collection.
- w
-
The number of servers to replicate a change to before returning success.
Value is inherited from the parent database. The
MongoDB class has a more detailed description of
how w works.
- wtimeout
-
The number of milliseconds to wait for $this->w
replications to take place. Value is inherited from the parent database.
The MongoDB class has a more detailed description
of how wtimeout works.
Table of Contents
User Contributed Notes
There are no user contributed notes for this page.