Sokil\Mongo\Collection::count PHP Method

count() public method

Total count of documents in collection
public count ( ) : integer
return integer
    public function count()
    {
        return $this->find()->count();
    }

Usage Example

Example #1
0
 public function testCancelOperation_BeforeDelete()
 {
     $document = $this->collection->delete()->createDocument(array('field' => 'value'))->save()->onBeforeDelete(function (\Sokil\Mongo\Event $event, $eventName, $dispatcher) {
         $event->cancel();
     })->delete();
     $this->assertEquals(1, $this->collection->count());
 }
All Usage Examples Of Sokil\Mongo\Collection::count