public function seeElementIsObject($collection, $criteria = [], $elementToCheck = null)
    {
        $collection = $this->driver->getDbh()->selectCollection($collection);

        $res = $collection->count(
            array_merge(
                $criteria,
                [
                    $elementToCheck => ['$exists' => true],
                    '$where' => "! Array.isArray(this.{$elementToCheck}) && isObject(this.{$elementToCheck})"
                ]
            )
        );
        if ($res > 1) {
            throw new \PHPUnit\Framework\ExpectationFailedException(
                'Error: you should test against a single element criteria when asserting that elementIsObject'
            );
        }
        \PHPUnit\Framework\Assert::assertEquals(1, $res, 'Specified element is not a Mongo Object');
    }
public function seeElementIsObject($collection, $criteria = [], $elementToCheck = null)
    {
        $collection = $this->driver->getDbh()->selectCollection($collection);

        $res = $collection->count(
            array_merge(
                $criteria,
                [
                    $elementToCheck => ['$exists' => true],
                    '$where' => "! Array.isArray(this.{$elementToCheck}) && isObject(this.{$elementToCheck})"
                ]
            )
        );
        if ($res > 1) {
            throw new \PHPUnit\Framework\ExpectationFailedException(
                'Error: you should test against a single element criteria when asserting that elementIsObject'
            );
        }
        \PHPUnit\Framework\Assert::assertEquals(1, $res, 'Specified element is not a Mongo Object');
    }
public function seeElementIsObject ( $ collection , $ criteria = [ ] , $ elementToCheck = null ) { $ collection = $ this -> driver -> getDbh ( ) -> selectCollection ( $ collection ) ; $ res = $ collection -> count ( array_merge ( $ criteria , [ $ elementToCheck => [ '$exists' => true ] , '$where' => "! Array.isArray(this.{$elementToCheck}) && isObject(this.{$elementToCheck})" ] ) ) ; if ( $ res > 1 ) { throw new \ PHPUnit \ Framework \ ExpectationFailedException ( 'Error: you should test against a single element criteria when asserting that elementIsObject' ) ; } \ PHPUnit \ Framework \ Assert :: assertEquals ( 1 , $ res , 'Specified element is not a Mongo Object' ) ; }
Asserts that an element in a collection exists and is an Object

``` php
<?php
$I->seeElementIsObject('users', array('name' => 'John Doe') , 'data');
```

@param String $collection
@param Array $criteria
@param String $elementToCheck
Asserts that an element in a collection exists and is an Object