                     keys: index
                     options: options
                   }
-            
+
                 indexList.push index
             else if Array.isArray indexes
               indexList = indexList.concat indexes
-        
+
             for propIdx, property of @_models[model].properties
               if property.index
                 index = {}
                 index[propIdx] = 1
-            
+
                 if typeof property.index is 'object'
                   # If there is a arangodb key for the index, use it
                   if typeof property.index.arangodb is 'object'

    @param [Function] [callback] Callback with (possible) error object and list of objects
  ###
  all: (model, filter, callback) =>
    all_aql = @filter2query model, filter

    @query all_aql.aql, all_aql.boundVars, (err, result) ->
      callback err if err
  
      # filter include
      if filter.include?
        @getModelClass.model.include result, filter.include, callback
      else
        callback null, result
  


  ###

  ###
  query: (query, bindVars, callback) =>
    debug 'query', query, bindVars if @debug

    if typeof bindVars is 'function'
      callback = bindVars
      bindVars = {}

    @db.query query, bindVars, (err, cursor) ->
      # workaround: when there is no error (e.g. wrong AQL syntax etc.) and no cursor, the authentication failed
      if not err? and cursor.length = 0
        authErr = new Error 'Authentication failed'
        callback authErr, null
      else
        callback err, cursor


  ###
    Checks the version of the ArangoDB

    @param callback [Function] The calback function, called with a (possible) error object and the server versio
  ###
  getVersion: (callback) =>
