public insert ( array | string $collection, array | object $data, array $options = [] ) : MongoDB\BSON\ObjectID | ||
$collection | array | string | collection name. |
$data | array | object | data to be inserted. |
$options | array | list of options in format: optionName => optionValue. |
return | MongoDB\BSON\ObjectID | new record id instance. |
public function insert($collection, $data, $options = [])
{
$this->beginProfile($token = " > insert into " . $this->composeCollectionLogName($collection) . ") ...");
$id = $this->db->getCollection($collection)->insert($data, $options);
$this->endProfile($token);
return $id;
}