I have a method written with node as follows to query from the collection
  query: function (model, conditon, options) {
            console.log(conditon, options);
            return new Promise(function (resolve, reject) {
                options = options || {};
                model.find(conditon, {}, options).exec(function (error, data) {
                    if (error)
                        reject(error);
                    resolve(data);
                })
            })
        }
i want to fetch the data for the following query,
db.getCollection('_event').find({}).sort({'metadata.popularity': 1}).limit(10)
How should i modify the above method to support this query?
This is how i call the query function from another file,
 dbService.query(eventModel, { 'eventId': idRetrieved }, {});
 }).then(data => dbService.disconnectDb(data))
    .then(data => callback(data))
     .catch((error) => {
          dbService.disconnectDb(error).then(error => {
          console.log(error);
          callback({}, error);
})

execreturns a promise if you don't provide a callback, so why are you creating your own promise? Anyway, where are the sort and limit parameters coming from?