     result
 
   convertComplexSelector: convertComplexSelector
-  castAll: castAll+  castAll: castAll

  return casted

castAll = (selector, konstructor, parents = []) ->
  casted = {}

  for own key, node of selector
  
    path      = parents.concat key
    pathName  = path.join '.'
    nodeType  = konstructor.types?[pathName]

           not konstructor.dontAutoCastId

        new ObjectId node

      when nodeType is String and node instanceof RegExp
        node

      when not parents.length and konstructor.castValue? and nodeType?
        konstructor.castValue node, nodeType

      else node

  return casted
