Exemple #1
0
 /**
  * Set index field
  *
  * @param string|array $field String (ex: -title | title) or array (ex: ['title' => -1])
  *
  * @throws \Webiny\Component\Mongo\MongoException
  * @return $this
  */
 public function setFields($field)
 {
     if ($this->isString($field)) {
         $field = [$field];
     }
     if ($this->isArray($field) && count($field) != 1) {
         throw new MongoException(MongoException::SINGLE_INDEX_TOO_MANY_FIELDS, [count($field)]);
     }
     return parent::setFields($field);
 }
Exemple #2
0
 public function getOptions()
 {
     $options = parent::getOptions();
     $options['default_language'] = $this->language;
     return $options;
 }