I want to create variable paging on Node.js with MongoDB. I use MongoJS on client side create a request:api\logs?&limit=val1&page=val2&sort=val3&order=val4&field1=val5&field2=val6wherelimit, page - paging sortorder, sort - sorting (sort - field. title,age & etc)  field1, filed2 ... - option for filterare all parameters optionally.What are the disadvantages of the method of processing the request and retrieving data? The planned volume of the collection of up to 100,000 records, fields, indexes are created.var listSort = ['time','request'];var defSort = listSort[0];var listOrder = ['-1','1'];var defOrder = listOrder[0];router.get('/', function(req, res){   var limit = (req.query.limit === undefined) ? 25 : req.query.limit;   var page = (req.query.page === undefined) ? 1 : req.query.page;   var sort =  listSort.indexOf(req.query.sort) == -1 ? defSort :  req.query.sort;   var order = listOrder.indexOf(req.query.order) == -1 ? defOrder : req.query.order;   var querySort = {};   querySort[sort] = parseInt(order);   var timeBegin = isNaN(Number(req.query.timeBegin)) ? undefined : Number(req.query.timeBegin);   var timeEnd = isNaN(Number(req.query.timeEnd))  ? undefined : Number(req.query.timeEnd);   var request = req.query.request;   var queryFind = {};   if(timeBegin || timeEnd){       queryFind['time']={};       if(timeBegin)           queryFind['time']['$gte']=timeBegin;       if(timeEnd)           queryFind['time']['$lte']=timeEnd;   }   if(request){       queryFind['request']=  new RegExp(request, 'i');   }   Log.find(queryFind).sort(querySort)   .limit(limit).skip(limit*(page-1), function(err, logItems) {       if (!err) res.json(logItems);       else res.send({error: err});   })});limit - the number of entries per pagepage - he current page numberlistSort - he list consists of a list of fields available for sortingdefSort - sort by defaultlistOrder - the list of sort orderdefOrder - default orderFilter for 'time'. Start and end. Perhaps no one of significance. Filter 'request'. This text field, search for possible inclusion content.
Node.js Paging with Mongodb
javascript;node.js;mongodb;pagination