   switch type
     when "$equal"
       # If the attribute is an array then search for the query value in the array the same as Mongo
-      if utils.isArray(attr) then (value in attr) else (attr is value)
+      if utils.isArray(attr) then utils.includes(attr, value) else (attr is value)
     when "$deepEqual"       then utils.isEqual(attr, value)
-    when "$contains"        then value in attr
+    when "$contains"        then utils.includes(attr, value)
     when "$ne"              then attr isnt value
     when "$lt"              then value? and attr < value
     when "$gt"              then value? and attr > value

    when "$gte"             then value? and attr >= value
    when "$between"         then value[0]? and value[1]? and value[0] < attr < value[1]
    when "$betweene"        then value[0]? and value[1]? and value[0] <= attr <= value[1]
    when "$in"              then attr in value
    when "$nin"             then attr not in value
    when "$all"             then utils.every value, (item) -> item in attr
    when "$any"             then utils.some attr, (item) -> item in value
    when "$size"            then attr.length is value
    when "$exists", "$has"  then attr? is value
    when "$like"            then attr.indexOf(value) isnt -1

    # 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 not utils.includes(compoundQuery, "$and")
        query.$and = {}
        compoundQuery.unshift "$and"
      for own key, val of query when not utils.includes(utils.compundKeys, key)
        query.$and[key] = val
        delete query[key]
    (for type in compoundQuery
