downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | conferences | my php.net

search for in the

MongoCollection::createDBRef> <MongoCollection::__construct
[edit] Last updated: Sat, 07 Jan 2012

view this page in

MongoCollection::count

(PECL mongo >=0.9.0)

MongoCollection::countCounts the number of documents in this collection

설명

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

인수

query

Associative array or object with fields to match.

limit

Specifies an upper limit to the number returned.

skip

Specifies a number of results to skip before starting the count.

반환값

Returns the number of documents matching the query.

변경점

버전 설명
1.0.7 Added limit and skip parameters.

예제

Example #1 MongoCollection::count() example

<?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)


add a note add a note User Contributed Notes MongoCollection::count - [0 notes]
There are no user contributed notes for this page.

 
show source | credits | stats | sitemap | contact | advertising | mirror sites