lib/mongodb/MongoDBCollection.js
function(options, context) {
    var self = this
    var query = undefined
    if (!_.isNil(options.query)) {
      query = _.clone(options.query)
      // handle _id queries passed in "_id" query parameter
      if (!_.isNil(options[this.idParameterName])) {
        if (_.isArray(options[this.idParameterName])) {
          if (options[this.idParameterName].length > 0) {
            query[this.idParameterName] = {
              $in: _.map(options[this.idParameterName], this._parseIdQueryParameter)
            }
          }
        } else {
          query[this.idParameterName] = this._parseIdQueryParameter(options[this.idParameterName])
        }
      }
    }
    // query
    var curs = this.collection.find(query)
    // project
    if (!_.isNil(options.projection)) {
      curs = curs.project(options.projection)
    }
    // skip
    if (!_.isNil(options.skip)) {
      curs = curs.skip(options.skip)
    }
    // limit
    if (!_.isNil(options.limit)) {
      curs = curs.limit(options.limit)
    }
    // sort
    if (!_.isNil(options.sort)) {
      curs = curs.sort(options.sort)
    }
    return curs.toArray()
  }
function(options, context) {
    var self = this
    var query = undefined
    if (!_.isNil(options.query)) {
      query = _.clone(options.query)
      // handle _id queries passed in "_id" query parameter
      if (!_.isNil(options[this.idParameterName])) {
        if (_.isArray(options[this.idParameterName])) {
          if (options[this.idParameterName].length > 0) {
            query[this.idParameterName] = {
              $in: _.map(options[this.idParameterName], this._parseIdQueryParameter)
            }
          }
        } else {
          query[this.idParameterName] = this._parseIdQueryParameter(options[this.idParameterName])
        }
      }
    }
    // query
    var curs = this.collection.find(query)
    // project
    if (!_.isNil(options.projection)) {
      curs = curs.project(options.projection)
    }
    // skip
    if (!_.isNil(options.skip)) {
      curs = curs.skip(options.skip)
    }
    // limit
    if (!_.isNil(options.limit)) {
      curs = curs.limit(options.limit)
    }
    // sort
    if (!_.isNil(options.sort)) {
      curs = curs.sort(options.sort)
    }
    return curs.toArray()
  }
function ( options , context ) { var self = this var query = undefined if ( ! _ . isNil ( options . query ) ) { query = _ . clone ( options . query ) // handle _id queries passed in "_id" query parameter if ( ! _ . isNil ( options [ this . idParameterName ] ) ) { if ( _ . isArray ( options [ this . idParameterName ] ) ) { if ( options [ this . idParameterName ] . length > 0 ) { query [ this . idParameterName ] = { $in : _ . map ( options [ this . idParameterName ] , this . _parseIdQueryParameter ) } } } else { query [ this . idParameterName ] = this . _parseIdQueryParameter ( options [ this . idParameterName ] ) } } } // query var curs = this . collection . find ( query ) // project if ( ! _ . isNil ( options . projection ) ) { curs = curs . project ( options . projection ) } // skip if ( ! _ . isNil ( options . skip ) ) { curs = curs . skip ( options . skip ) } // limit if ( ! _ . isNil ( options . limit ) ) { curs = curs . limit ( options . limit ) } // sort if ( ! _ . isNil ( options . sort ) ) { curs = curs . sort ( options . sort ) } return curs . toArray ( ) }
***************************************************************************
@method find
@description Retrieve objects from a collection
@param {Object} options -- The operation parameters (see:
{@link carbond.mongodb.MongoDBCollection.FindConfigClass})
@param {Object} context -- A free form object to pass data between hook and handler
methods
@returns {Object[]} -- A list of objects
@throws {carbond.collections.errors.CollectionError}
***************************************************************************