MongoCollection::validate PHP Method

validate() public method

Validates this collection
public validate ( boolean $scan_data = FALSE ) : array
$scan_data boolean Only validate indices, not the base collection.
return array Returns the database's evaluation of this object.
    public function validate($scan_data = FALSE)
    {
        $command = ['validate' => $this->name, 'full' => $scan_data];
        return $this->db->command($command);
    }

Usage Example

    public function testValidate() {
      $v = $this->object->validate();
      $this->assertEquals((bool)$v['ok'], false);
      $this->assertEquals($v['errmsg'], 'ns not found');

      $this->object->insert(array('a' => 'foo'));
      $v = $this->object->validate();
      $this->assertEquals((bool)$v['ok'], true);
      $this->assertEquals($v['ns'], 'phpunit.c');
    }
All Usage Examples Of MongoCollection::validate