MongoHybrid\Mongo::insert PHP Method

insert() public method

public insert ( $collection, &$doc )
    public function insert($collection, &$doc)
    {
        if (isset($doc["_id"]) && is_string($doc["_id"])) {
            $doc["_id"] = new \MongoId($doc["_id"]);
        }
        $ref = $doc;
        $return = $this->getCollection($collection)->insert($ref);
        if (isset($ref["_id"])) {
            $ref["_id"] = (string) $ref["_id"];
        }
        $doc = $ref;
        return $return;
    }