Merges the supplied argument hash into a single criteria

 Options:

 criteria_conditions: Hash of criteria keys, and parameter values

 Example:

 <tt>criteria.fuse(:where => { :field => "value"}, :limit => 20)</tt>

 Returns <tt>self</tt>
337582
def fuse(criteria_conditions = {})
      criteria_conditions.inject(self) do |criteria, (key, value)|
        criteria.send(key, value)
      end
    end
1363011
function( filters, fieldPrefix, selectorWithoutBells ){
    return  {
      querySelector: this._makeMongoConditions( filters.conditions || {}, fieldPrefix, selectorWithoutBells ),
      sortHash:  this._makeMongoSortHash( filters.sort || {}, fieldPrefix )
    };
  }
991868
def _build_search_values(self, kwargs):
        
        criteria = {}
        for key in self._search_by:
            if getattr(self, key, None):
                criteria[key] = getattr(self, key)
            elif key in kwargs and kwargs.get(key):
                criteria[key] = kwargs.get(key)
        return criteria
1024231
def options
      VALID_OPTIONS_KEYS.reduce({}) do |options, key|
        options.merge(key => send(key))
      end
    end
1161286
def assert_valid_options(options)
      options = options.to_hash

      options.each do |attribute, value|
        case attribute
          when :fields                         then assert_valid_fields(value, options[:unique])
          when :links                          then assert_valid_links(value)
          when :conditions                     then assert_valid_conditions(value)
          when :offset                         then assert_valid_offset(value, options[:limit])
          when :limit                          then assert_valid_limit(value)
          when :order                          then assert_valid_order(value, options[:fields])
          when :unique, :add_reversed, :reload then assert_valid_boolean("options[:#{attribute}]", value)
          else
            assert_valid_conditions(attribute => value)
        end
      end
    end
128791
private void addCriterionsToCriteria(Criteria criteria, Criterion... criterion) {
        if (criteria != null) {
            for (Criterion c : criterion) {
                if (c != null) {
                    criteria.add(c);
                }
            }
        }
    }
592317
def find_one(conditions_or_id)
      return nil if conditions_or_id.nil?
      if Hash === conditions_or_id
        Mongoid::Criteria.translate(self, conditions_or_id).one
      else
        Mongoid::Criteria.translate(self, conditions_or_id)
      end
    end
628886
def merge!(pairs, options={}, &block)
      return super unless method = [:merge!, :update].find do |method|
        @backend.respond_to? method
      end

      hash = Hash === pairs ? pairs : Hash[pairs.to_a]
      case method
      when :merge!
        @backend.merge!(hash, &block)
      when :update
        @backend.update(hash, &block)
      end

      self
    end
932950
def merge!(pairs, options={})
      expires = expires_at(options)
      options = Utils.without(options, :expires)

      block = if block_given?
                lambda do |key, old_entry, entry|
                  old_entry = invalidate_entry(key, old_entry)
                  if old_entry.nil?
                    entry # behave as if no replace is happening
                  else
                    old_value, _ = old_entry
                    new_value, _ = entry
                    new_entry(yield(key, old_value, new_value), expires)
                  end
                end
              end

      entry_pairs = pairs.map do |key, value|
        [key, new_entry(value, expires)]
      end
      @adapter.merge!(entry_pairs, options, &block)
      self
    end
669564
def union(self, enumerable, key=lambda x: x):
        
        if not isinstance(enumerable, Enumerable3):
            raise TypeError(
                u"enumerable parameter must be an instance of Enumerable")
        if self.count() == 0:
            return enumerable
        if enumerable.count() == 0:
            return self
        return self.concat(enumerable).distinct(key)
481182
def merge!(hash)
      hash.each do |key, value|
        if config_contexts.key?(key)
          # Grab the config context and let internal_get cache it if so desired
          config_contexts[key].restore(value)
        else
          configuration[key] = value
        end
      end
      self
    end
108726
def expand_hash_conditions_for_aggregates(attrs)
      expanded_attrs = attrs.dup
      attr_enumeration_mapping_classes.each do |attr, klass|
        if expanded_attrs[attr].is_a?(Symbol)
          expanded_attrs[attr] = klass.from_sym(expanded_attrs[attr])
        end
      end
      super(expanded_attrs)
    end
506268
def slice(criterion = nil)
      option(criterion) do |options|
        options.__union__(
          fields: criterion.inject({}) do |option, (field, val)|
            option.tap { |opt| opt.store(field, { "$slice" => val }) }
          end
        )
      end
    end
905245
def build(option_hash)
      opts = option_hash.dup || {}
      @relation = @base.scoped
      opts.stringify_keys!
      opts = collapse_multiparameter_options(opts)
      assign_attributes(opts)
      self
    end
1060120
private Condition buildIdCondition(Object argument) {
         if (argument instanceof String && ObjectId.isValid((String) argument)) {
             return new Condition(ID_FIELD, new ObjectId((String) argument));
         } else if (Iterable.class.isAssignableFrom(argument.getClass())) {
             List<Object> objectIds = new ArrayList<Object>();

             //noinspection ConstantConditions
             for (Object argumentItem : (Iterable) argument) {
                 if (argumentItem instanceof String && ObjectId.isValid((String) argumentItem)) {
                     objectIds.add(new ObjectId((String) argumentItem));
                 } else if (argumentItem instanceof ObjectId) {
                     objectIds.add( argumentItem);
                 }
             }

             return new Condition(ID_FIELD, new BasicDBObject("$in", objectIds));
         } else {
             return new Condition(ID_FIELD, argument);
         }
     }
365528
def assert_valid_conditions(conditions)
      case conditions
        when Hash
          conditions.each do |subject, bind_value|
            case subject
              when Symbol, String
                original = subject
                subject  = subject.to_s
                name     = subject[0, subject.index('.') || subject.length]

                unless @properties.named?(name) || @relationships.named?(name)
                  raise ArgumentError, "condition #{original.inspect} does not map to a property or relationship in #{model}"
                end
            end
          end

        when Array
          if conditions.empty?
            raise ArgumentError, '+options[:conditions]+ should not be empty'
          end

          first_condition = conditions.first

          unless first_condition.kind_of?(String) && !DataMapper::Ext.blank?(first_condition)
            raise ArgumentError, '+options[:conditions]+ should have a statement for the first entry'
          end
      end
    end
146340
def parse_condition(
    cond, selectable, aggregated=False, default_aggregation='sum'
):
    """"""
    if cond is None:
        return None

    else:
        if 'and' in cond:
            conditions = [
                parse_condition(
                    c, selectable, aggregated, default_aggregation
                ) for c in cond['and']
            ]
            return and_(*conditions)
        elif 'or' in cond:
            conditions = [
                parse_condition(
                    c, selectable, aggregated, default_aggregation
                ) for c in cond['or']
            ]
            return or_(*conditions)
        elif 'field' not in cond:
            raise BadIngredient('field must be defined in condition')
        field = parse_field(
            cond['field'],
            selectable,
            aggregated=aggregated,
            default_aggregation=default_aggregation
        )
        if 'in' in cond:
            value = cond['in']
            if isinstance(value, dict):
                raise BadIngredient('value for in must be a list')
            condition_expression = getattr(field, 'in_')(tuple(value))
        elif 'gt' in cond:
            value = cond['gt']
            if isinstance(value, (list, dict)):
                raise BadIngredient('conditional value must be a scalar')
            condition_expression = getattr(field, '__gt__')(value)
        elif 'gte' in cond:
            value = cond['gte']
            if isinstance(value, (list, dict)):
                raise BadIngredient('conditional value must be a scalar')
            condition_expression = getattr(field, '__ge__')(value)
        elif 'lt' in cond:
            value = cond['lt']
            if isinstance(value, (list, dict)):
                raise BadIngredient('conditional value must be a scalar')
            condition_expression = getattr(field, '__lt__')(value)
        elif 'lte' in cond:
            value = cond['lte']
            if isinstance(value, (list, dict)):
                raise BadIngredient('conditional value must be a scalar')
            condition_expression = getattr(field, '__le__')(value)
        elif 'eq' in cond:
            value = cond['eq']
            if isinstance(value, (list, dict)):
                raise BadIngredient('conditional value must be a scalar')
            condition_expression = getattr(field, '__eq__')(value)
        elif 'ne' in cond:
            value = cond['ne']
            if isinstance(value, (list, dict)):
                raise BadIngredient('conditional value must be a scalar')
            condition_expression = getattr(field, '__ne__')(value)
        else:
            raise BadIngredient('Bad condition')

        return condition_expression