lib/impl/getSubmissions/index.js
function nonPaginateList(formSubmissionModel, params, callback) {
  logger.debug("nonPaginateList", params);
  var submissionQuery = formSubmissionModel.find(params.query || {});
  var fieldModel = params.fieldModel;

  //Sorting can be defined by the user
  var sortBy = params.sortBy || {
    submissionCompletedTimestamp: -1
  };

  //If the full submission is not required, then limit the response payload size.
  if (!params.includeFullSubmission) {
    submissionQuery.select({"formSubmittedAgainst.name": 1, "_id": 1, "formId": 1, "appId": 1, "appEnvironment": 1, "formFields": 1});
  }

  submissionQuery.sort(sortBy)
  .populate({"path": "formFields.fieldId", "model": fieldModel, "select": "_id type name"})
  //Assigning a lean query to not parse the response as a mongoose document. This is to improve query performance.
  .lean()
  .exec(function(err, foundSubmissions) {
    handleListResult(err, params, foundSubmissions, callback);
  });
}
function nonPaginateList(formSubmissionModel, params, callback) {
  logger.debug("nonPaginateList", params);
  var submissionQuery = formSubmissionModel.find(params.query || {});
  var fieldModel = params.fieldModel;

  //Sorting can be defined by the user
  var sortBy = params.sortBy || {
    submissionCompletedTimestamp: -1
  };

  //If the full submission is not required, then limit the response payload size.
  if (!params.includeFullSubmission) {
    submissionQuery.select({"formSubmittedAgainst.name": 1, "_id": 1, "formId": 1, "appId": 1, "appEnvironment": 1, "formFields": 1});
  }

  submissionQuery.sort(sortBy)
  .populate({"path": "formFields.fieldId", "model": fieldModel, "select": "_id type name"})
  //Assigning a lean query to not parse the response as a mongoose document. This is to improve query performance.
  .lean()
  .exec(function(err, foundSubmissions) {
    handleListResult(err, params, foundSubmissions, callback);
  });
}
function nonPaginateList ( formSubmissionModel , params , callback ) { logger . debug ( "nonPaginateList" , params ) ; var submissionQuery = formSubmissionModel . find ( params . query || { } ) ; var fieldModel = params . fieldModel ; //Sorting can be defined by the user var sortBy = params . sortBy || { submissionCompletedTimestamp : - 1 } ; //If the full submission is not required, then limit the response payload size. if ( ! params . includeFullSubmission ) { submissionQuery . select ( { "formSubmittedAgainst.name" : 1 , "_id" : 1 , "formId" : 1 , "appId" : 1 , "appEnvironment" : 1 , "formFields" : 1 } ) ; } submissionQuery . sort ( sortBy ) . populate ( { "path" : "formFields.fieldId" , "model" : fieldModel , "select" : "_id type name" } ) //Assigning a lean query to not parse the response as a mongoose document. This is to improve query performance. . lean ( ) . exec ( function ( err , foundSubmissions ) { handleListResult ( err , params , foundSubmissions , callback ) ; } ) ; }
nonPaginateList - Listing submissions without pagination

@param  {object} formSubmissionModel Submission Mongoose Model
@param  {object} params
@param  {object} params.query          Query to filter by.
@param  {function} callback
nonPaginateList - Listing submissions without pagination