MongoCollection::count

(PECL mongo >=0.9.0)

MongoCollection::count锟斤拷锟截硷拷锟斤拷锟叫碉拷锟侥碉拷锟斤拷锟斤拷

说锟斤拷

public MongoCollection::count ([ array $query = array() [, int $limit = 0 [, int $skip = 0 ]]] ) : int

锟斤拷锟斤拷

query

锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷叨锟斤拷螅锟斤拷锟斤拷锟揭ワ拷锟斤拷锟街段★拷

limit

指锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟睫★拷

skip

指锟斤拷锟节匡拷始统锟斤拷前锟斤拷锟斤拷要锟斤拷锟斤拷锟侥斤拷锟斤拷锟侥匡拷锟�

锟斤拷锟斤拷值

锟斤拷锟截诧拷询匹锟戒到锟斤拷锟侥碉拷锟斤拷目锟斤拷

锟斤拷锟斤拷锟斤拷志

锟芥本 说锟斤拷
1.0.7 锟斤拷锟斤拷锟� limit 锟斤拷 skip 锟斤拷锟斤拷锟斤拷

锟斤拷锟斤拷

Example #1 MongoCollection::count() 锟斤拷锟斤拷

<?php

$collection
->insert(array('x'=>1));
$collection->insert(array('x'=>2));
$collection->insert(array('x'=>3));

var_dump($collection->count());
var_dump($collection->count(array('x'=>1)));

?>

锟斤拷锟斤拷锟斤拷锟教碉拷锟斤拷锟斤拷锟斤拷锟斤拷冢锟�

int(3)
int(1)