original_string: public function insert($entity, array $options = [], bool $fireEvents = true): bool
      {
          if ($fireEvents && false === $this->fireEvent('inserting', $entity, true)) {
              return false;
          }
  
          $data = $this->parseToDocument($entity);
  
          $queryResult = $this->getCollection()->insertOne(
              $data,
              $this->mergeOptions($options)
          );
  
          $result = $queryResult->isAcknowledged() && $queryResult->getInsertedCount();
  
          if ($result) {
              $this->afterSuccess($entity);
  
              if ($fireEvents) {
                  $this->fireEvent('inserted', $entity);
              }
          }
  
          return $result;
      }
code: public function insert($entity, array $options = [], bool $fireEvents = true): bool
      {
          if ($fireEvents && false === $this->fireEvent('inserting', $entity, true)) {
              return false;
          }
  
          $data = $this->parseToDocument($entity);
  
          $queryResult = $this->getCollection()->insertOne(
              $data,
              $this->mergeOptions($options)
          );
  
          $result = $queryResult->isAcknowledged() && $queryResult->getInsertedCount();
  
          if ($result) {
              $this->afterSuccess($entity);
  
              if ($fireEvents) {
                  $this->fireEvent('inserted', $entity);
              }
          }
  
          return $result;
      }
code_tokens: public function insert ( $ entity , array $ options = [ ] , bool $ fireEvents = true ) : bool { if ( $ fireEvents && false === $ this -> fireEvent ( 'inserting' , $ entity , true ) ) { return false ; } $ data = $ this -> parseToDocument ( $ entity ) ; $ queryResult = $ this -> getCollection ( ) -> insertOne ( $ data , $ this -> mergeOptions ( $ options ) ) ; $ result = $ queryResult -> isAcknowledged ( ) && $ queryResult -> getInsertedCount ( ) ; if ( $ result ) { $ this -> afterSuccess ( $ entity ) ; if ( $ fireEvents ) { $ this -> fireEvent ( 'inserted' , $ entity ) ; } } return $ result ; }
docstring: Inserts the given object into database. Returns success if write concern
  is acknowledged. Since it's an insert, it will fail if the _id already
  exists.
  
  Notice: Inserts with Unacknowledged WriteConcern will not fire `inserted` event.
  
  @param mixed $entity     the entity used in the operation
  @param array $options    possible options to send to mongo driver
  @param bool  $fireEvents whether events should be fired
  
  @return bool Success (but always false if write concern is Unacknowledged)
docstring_tokens: Inserts the given object into database . Returns success if write concern is acknowledged . Since it s an insert it will fail if the _id already exists .