     # find if there is an implicit $and compundQuery operator
     if compoundQuery.length isnt queryKeys.length
       # Add the and compund query operator (with a sanity check that it doesn't exist)
-      if "$and" not in compoundQuery
+      if not utils.includes(compoundQuery, "$and")
         query.$and = {}
         compoundQuery.unshift "$and"
-      for own key, val of query when key not in utils.compoundKeys
+      for own key, val of query when not utils.includes(utils.compundKeys, key)
         query.$and[key] = val
         delete query[key]
     (for type in compoundQuery


      when "Object"
      # If the key is one of the compound keys, then parse the param as a raw query
        if key in utils.compoundKeys
          o.type = key
          o.value = parseSubQuery queryParam, key
          o.key = null

    (item for item in array1 when array2.indexOf(item) isnt -1)

  out.isEqual = (a,b) -> JSON.stringify(a) is JSON.stringify(b)

  out.includes = (a, b) -> b in a
  out


