Fetch the default set of entities for this collection, resetting the collection when they arrive. If `reset: true` is passed, the response data will be passed through the `reset` method instead of `set`.
171472
function(options) {
      options = langx.mixin({parse: true}, options);
      var success = options.success;
      var collection = this;
      options.success = function(resp) {
        var method = options.reset ? 'reset' : 'set';
        collection[method](resp, options);
        if (success) success.call(options.context, collection, resp, options);
        collection.trigger('sync', collection, resp, options);
      };
      wrapError(this, options);
      return this.sync('read', this, options);
    }
817134
def collections(self):
        
        iterator = self._firestore_api.list_collection_ids(
            self._database_string, metadata=self._rpc_metadata
        )
        iterator.client = self
        iterator.item_to_value = _item_to_collection_ref
        return iterator
1024119
function loadCollection(collection, data) {
        return Q(collection.fetch()).then(function () {
            // delete all before running tests
            return Q.all(collection.models.slice().map(function (model) {
                return model.destroy();
            })).then(function () {
                chai_1.assert.equal(collection.models.length, 0, 'collection must be empty initially after destroy');
                return collection;
            });
        }).then(function (collection2) {
            // load sample data into fresh database
            chai_1.assert.equal(collection2, collection, 'same collection object');
            return Q.all(data.map(function (attrs) {
                return new TestModel(attrs, {
                    collection: collection2
                }).save();
            })).then(function () {
                chai_1.assert.equal(collection2.models.length, data.length, 'collection was updated by async events');
                return collection2;
            });
        });
    }
990491
function defaults($set=false) {
		$out = [];
		$fields = $this->fieldConf;
		if ($this->dbsType == 'sql')
			$fields = array_replace_recursive($this->mapper->schema(),$fields);
		foreach($fields as $field_key => $field_conf)
			if (array_key_exists('default',$field_conf)) {
				$val = ($field_conf['default'] === \DB\SQL\Schema::DF_CURRENT_TIMESTAMP)
					? date('Y-m-d H:i:s') : $field_conf['default'];
				if ($val!==NULL) {
					$out[$field_key]=$val;
					if ($set)
						$this->set($field_key, $val);
				}
			}
		return $out;
	}
1200466
public function reset()
    {
        $this->builder->resetQueryParts();
        $this->relations = [];
        $this->queryString = null;
        $this->queryParams = [];
        $this->casts = [];
        $this->resetBinds();

        $this->setQuery();
        $this->fields();

        return $this;
    }
51319
def filtany(entities, **kw):
  
  ret = set()
  for k,v in kw.items():
    for entity in entities:
      if getattr(entity, k)() == v:
        ret.add(entity)
  return ret
608129
function(_options){
      var self = this, //collection
          options = _options || {},
          success = options.success; //custom success function passed in _options

      options.success = function(data){
        var toAdd = [];

        for(var model in data){
          toAdd.push(data[model]);
        }

        self.reset(); //reset the collection
        if(toAdd.length > 0) self.add(toAdd);
        if(success) success(self, data);
      };

      return this.sync.call(this, 'fetch', this, options);
    }
718373
public function reset()
    {
        $this->data = [];

        // Get the default values for the class from the table.
        foreach ((array) $this->getFields() as $k => $v) {
            $this->data[$k] = null;
        }

        return $this;
    }
357982
public static Fetch createDefaultEntityFetch(EntityType entityType, String languageCode) {
    boolean hasRefAttr = false;
    Fetch fetch = new Fetch();
    for (Attribute attr : entityType.getAtomicAttributes()) {
      Fetch subFetch = createDefaultAttributeFetch(attr, languageCode);
      if (subFetch != null) {
        hasRefAttr = true;
      }
      fetch.field(attr.getName(), subFetch);
    }
    return hasRefAttr ? fetch : null;
  }
590353
protected function createDefaultSet()
    {
        $pages = SiteTree::get();
        foreach ($pages as $page) {
            // Only handle valid page types
            if (!$page->config()->get('documents_enabled')) {
                $this->addResult('Skipped: documents disabled');
                continue;
            }

            if ($page->DocumentSets()->count()) {
                // Don't add a set if it already has one
                $this->addResult('Skipped: already has a set');
                continue;
            }
            $this->addDefaultDocumentSet($page);
            $this->addResult('Default document set added');
        }
        return $this;
    }
293317
public function reset()
	{
		// Get the default values for the class from the table.
		foreach ($this->getFields() as $k => $v)
		{
			// If the property is not the primary key or private, reset it.
			if ($k != $this->_tbl_key && (strpos($k, '_') !== 0))
			{
				$this->$k = $v->Default;
			}
		}
	}
1286411
def current
      response = request(:get_all_current)
      handles = response.values.flatten.collect { |handle| Entity::Handle.build(handle) }
      initialize_items
      get_data_for_handles(handles)

      self
    end
1199696
def get_collection(self, request, **resources):
        
        if self._meta.queryset is None:
            return []

        # Filter collection
        filters = self.get_filters(request, **resources)
        filters.update(self.get_default_filters(**resources))
        qs = self._meta.queryset
        for key, (value, exclude) in filters.items():
            try:
                if exclude:
                    qs = qs.exclude(**{key: value})

                else:
                    qs = qs.filter(**{key: value})
            except FieldError, e:
                logger.warning(e)

        sorting = self.get_sorting(request, **resources)
        if sorting:
            qs = qs.order_by(*sorting)

        return qs
822886
def set_default(self):
        
        queryset = self.get_default_queryset()
        if queryset.exists():
            queryset.update(default=False)
196138
def reset(self):
        """"""
        if self.collname not in self.current_kv_names():
            return # nothing to do
        # we'll simply delete the entire collection and then re-create it.
        r = self.request('delete',
                         self.url+"storage/collections/data/"+self.collname)
        r.raise_for_status()
        self.initialize()
131724
public static function defaults_set() {
        list($purposeid, $categoryid) = self::get_defaults(CONTEXT_SYSTEM);
        if (empty($purposeid) || empty($categoryid)) {
            return false;
        }
        return true;
    }
1003750
function(options) {
          options = options ? _.clone(options) : {};
          if (options.parse === void 0) { options.parse = true; }
          var success = options.success;
          var collection = this;
          options.success = function(resp) {
            var arr = [];
            var keys = _.keys(resp);
            _.each(keys, function(key) {
              arr.push(resp[key]);
            });
            var method = options.reset ? 'reset' : 'set';
            collection[method](arr, options);
            if (success) { success(collection, arr, options); }
            options.autoSync = false;
            options.url = this.url;
            collection.trigger('sync', collection, arr, options);
          };
          return this.sync('read', this, options);
        }