Perform collection items filtering with schema
195169
def filter_with_schema(self, collection=None, context=None):
        
        if collection is None or self.schema is None:
            return

        try:
            for item in collection:
                self._schema.filter(
                    model=item,
                    context=context if self.use_context else None
                )
        except TypeError:
            pass
723559
function (field) {
            var schemaDefinition = this.schema[field];
            if (!schemaDefinition) {
                throw "Couldn't find '" + field + "' in schema";
            }
            var collection = this.get(field);
            if (!collection) {
                var context = this.getContextForChild(schemaDefinition.type);
                if (context) {
                    collection = context.createCollection(schemaDefinition.type, null);
                    collection.$parent = this;
                    this.set(field, collection);
                } else {
                    throw "Couldn't determine context for " + field;
                }
            }
            return collection;


        }
870635
public function FilterSchema($Data) {
      $Fields = $this->Schema->Fields($this->Name);

      $Result = array_intersect_key($Data, $Fields);
      return $Result;
   }
1208384
def filter(cls, **items):
        '''
        
        '''
        client = cls._new_api_client(subpath='/search')
        items_dict = dict((k, v) for k, v in list(items.items()))
        json_data = json.dumps(items_dict, sort_keys=True, indent=4)
        return client.make_request(cls, 'post', post_data=json_data)
268221
def filter(self, table, cgroups, filter_string):
        """"""
        query = filter_string.lower()
        return [cgroup for cgroup in cgroups
                if query in cgroup.name.lower()]
1079045
def many(cls, filter=None, **kwargs):
        """"""
        from mongoframes.queries import Condition, Group, to_refs

        # Flatten the projection
        kwargs['projection'], references, subs = \
                cls._flatten_projection(
                    kwargs.get('projection', cls._default_projection)
                    )

        # Find the documents
        if isinstance(filter, (Condition, Group)):
            filter = filter.to_dict()

        documents = list(cls.get_collection().find(to_refs(filter), **kwargs))

        # Dereference the documents (if required)
        if references:
            cls._dereference(documents, references)

        # Add sub-frames to the documents (if required)
        if subs:
            cls._apply_sub_frames(documents, subs)

        return [cls(d) for d in documents]
765311
def _query(options, collection_name, num_to_skip,
           num_to_return, query, field_selector, opts, check_keys):
    """"""
    encoded = _dict_to_bson(query, check_keys, opts)
    if field_selector:
        efs = _dict_to_bson(field_selector, False, opts)
    else:
        efs = b""
    max_bson_size = max(len(encoded), len(efs))
    return b"".join([
        _pack_int(options),
        _make_c_string(collection_name),
        _pack_int(num_to_skip),
        _pack_int(num_to_return),
        encoded,
        efs]), max_bson_size
1016632
def select_by_field(self, base, field, value):
        """"""
        Ac = self.ACCES
        return groups.Collection(Ac(base, i) for i, row in self.items() if row[field] == value)
573532
def get(self, schema, query=None, **kwargs):
        
        ret = self._get_query(self._get, schema, query, **kwargs)
        if not ret: ret = []
        return ret
233491
def apply_filter(
        filter_fn,
        collection,
        result_fn=None,
        filter_name="",
        collection_name=""):
    
    n_before = len(collection)
    filtered = [x for x in collection if filter_fn(x)]
    n_after = len(filtered)
    if not collection_name:
        collection_name = collection.__class__.__name__
    logging.info(
        "%s filtering removed %d/%d entries of %s",
        filter_name,
        (n_before - n_after),
        n_before,
        collection_name)
    return result_fn(filtered) if result_fn else collection.__class__(filtered)
258650
def filter_collection(ignore_keys)
      return @collection if ignore_keys.blank?
      @collection.select { |kv_item| !ignore_keys.include?(kv_item.keys.first) }
    end
122270
def get_dbcollection_with_es(self, **kwargs):
        
        es_objects = self.get_collection_es()
        db_objects = self.Model.filter_objects(es_objects)
        return db_objects
461661
function buildFilters(filters) {
    var builtFilters = [];
    filters.forEach(function(filter) {
      builtFilters.push(MongoDatabase.buildFilter(filter));
    });
    return builtFilters;
  }
1330989
async def filter(self, request, **kwargs):
        """"""
        try:
            data = loads(request.query.get(VAR_WHERE))
        except (ValueError, TypeError):
            return self.collection

        self.filters, collection = self.meta.filters.filter(
            data, self.collection, resource=self, **kwargs)

        return collection
17530
def filter(self, *predicates):
        
        predicates = self._get_fields(predicates)

        predicate = reduce(operator.and_, predicates)
        return FilterCollectionExpr(self, predicate, _schema=self._schema)
905862
function get_related_in_payload(collection, payload) {
  // If there's nothing to filter, just exit with nothing.
  if (!payload) return []

  // Get the keys that are associations in the collection.
  const related_in_collection = new Set(get_related_columns(collection))

  // Filter the payload based on the collection's associations.
  return Object.keys(payload).filter(key => related_in_collection.has(key))
}
248782
function someCollections(db, collections, next) {

  var last = ~~collections.length, counter = 0;
  if (last === 0) { // empty set
    return next(null);
  }

  collections.forEach(function(collection) {

    db.collection(collection, function(err, collection) {

      logger('select collection ' + collection.collectionName);
      if (err) {
        return last === ++counter ? next(err) : error(err);
      }
      collection.drop(function(err) {

        if (err) {
          error(err); // log if missing
        }
        return last === ++counter ? next(null) : null;
      });
    });
  });
}