   compoundQuery = utils.intersection utils.compoundKeys, queryKeys
 
   for type in compoundQuery
-    if type in utils.expectedArrayQueries and !utils.isArray(query[type])
+    if not utils.isArray(query[type]) and utils.includes(utils.expectedArrayQueries, type)
       throw new Error(type + ' query must be an array')
 
   # If no compound methods are found then use the "and" iterator

        o.value = queryParam

    # For "$equal" queries with arrays or objects we need to perform a deep equal
    if (o.type is "$equal") and (paramType in ["Object","Array"])
      o.type = "$deepEqual"

    result.push(o)

    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 utils.includes(value, attr)
    when "$nin"             then not utils.includes(value, attr)
    when "$all"             then utils.every value, (item) -> utils.includes(attr, item)
    when "$any"             then utils.some attr, (item) -> utils.includes(value, item)
    when "$size"            then attr.length is value
    when "$exists", "$has"  then attr? is value
    when "$like"            then attr.indexOf(value) isnt -1
