docs: function parse(req, res, next) {
  
  
      // Test if resource exists
      if (!db.object.hasOwnProperty(req.params.resource)) {
        return res.sendStatus(404)
      }
  
      // Set internals
      req._internal = {}
  
      // Filters list
      req._internal.filters = {}
  
      // Result array
      var array
  
      // Remove _start, _end and _limit from req.query to avoid filtering using those
      // parameters. Attach to req._internal for use by future middleware
      req._internal._start = req.query._start
      req._internal._end = req.query._end
      req._internal._sort = req.query._sort
      req._internal._order = req.query._order
      req._internal._limit = req.query._limit
      delete req.query._start
      delete req.query._end
      delete req.query._sort
      delete req.query._order
      delete req.query._limit
  
      // Handle sub resources if present, and assign id if it's not already there.
      req._internal.subResources = []
      if (req.params['0']) { // If anything beyond the first resource is provided
        req._internal.subResources = req.params['0'].split('/')
        req._internal.subResources.shift()
        req._internal.subResourceMap = []
        req._internal.originalId = req._internal.subResources.shift() // set the resource's original to the first variadic parameter
        _.forEach(req._internal.subResources, function (value, index) { // build the subResource objects as provided
          var obj = {}
          if (index % 2 > 0) { // if this parameter is even, build an object with id, resource, and <parent>Id
            obj.id = value
            obj.resource = req._internal.subResources[index - 1]
            if (index > 1) {
              obj[req._internal.subResources[index - 3].slice(0, -1) + 'Id'] = req._internal.subResources[index - 2]
            } else {
              obj[req.params.resource.slice(0, -1) + 'Id'] = req._internal.originalId
            }
            req._internal.subResourceMap.push(obj)
          } else if (index === (req._internal.subResources.length - 1)) { // if this parameter is odd AND the last one, build an object without an ID
            obj.resource = value
            if (index > 1) {
              obj[req._internal.subResources[index - 2].slice(0, -1) + 'Id'] = req._internal.subResources[index - 1]
            }
            req._internal.subResourceMap.push(obj)
          }
        })
        if (req._internal.subResourceMap.length > 0) { // if there are any subResources at all (e.g. /posts/12/comments, /posts/12/comments/247, /posts/12/comments/247/user, ...)
  
          // Set up parents
          if (req._internal.subResourceMap.length < 2) { // if there is only one subResource (e.g. /posts/12/comments, /posts/12/comments/247)
            req._internal.parent = req.params.resource // Assign original resource and id to parent
            req._internal.parentId = req._internal.originalId
          } else { // if there is more than one subResource (e.g. /posts/12/comments/247/user, /posts/12/comments/247/user/25, ...)
            req._internal.parent = req._internal.subResourceMap[req._internal.subResourceMap.length - 2].resource // Assign the second to last subResource as parent
            req._internal.parentId = req._internal.subResourceMap[req._internal.subResourceMap.length - 2].id
          }
          req._internal.filters[req._internal.parent.slice(0, -1) + 'Id'] = +req._internal.parentId
  
          // Set up resource
          req.params.resource = req._internal.subResourceMap[req._internal.subResourceMap.length - 1].resource // assign the last subResource's data to resource and id
          if (req._internal.subResourceMap[req._internal.subResourceMap.length - 1].id) {
            req._internal.originalId = req._internal.subResourceMap[req._internal.subResourceMap.length - 1].id
          } else {
            delete req._internal.originalId // remove id if subResource doesn't have one
          }
        }
      }
      if (req._internal.originalId) {
        req._internal.filters.id = +req._internal.originalId // convert original ID to number and set as filter
        if (req._internal.filters.id.toString() === req._internal.originalId) {
          delete req._internal.originalId
        }
        if (isNaN(req._internal.filters.id)) {
          req._internal.filters.id = req._internal.originalId
        }
      }
  
      // Add query parameters filters
      // Convert query parameters to their native counterparts
      for (var key in req.query) {
  
        // don't take into account JSONP query parameters
        // jQuery adds a '_' query parameter too
        if (key !== 'callback' && key !== '_') {
          req._internal.filters[key] = utils.toNative(req.query[key])
        }
      }
      next()
    }