Werbung
MongoCollection::count
(PECL mongo >=0.9.0)
MongoCollection::count — Counts the number of documents in this collection
Beschreibung
Parameter-Liste
- query
-
Array or object with fields to match.
Rückgabewerte
Returns the number of documents matching the query.
Beispiele
PHP Code
1
2
3
4
5
2
3
4
5
$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)));
Das oben gezeigte Beispiel erzeugt eine ähnliche Ausgabe wie:
int(3) int(1)