1
0
mirror of https://github.com/node-red/node-red-nodes.git synced 2023-10-10 13:36:58 +02:00

Make msg.limit and msg.skip optional as per the README (#303)

This commit is contained in:
Ben Hardill 2017-04-19 11:11:47 +01:00 committed by Dave Conway-Jones
parent f2cc2bb321
commit c17aac3b66

View File

@ -206,10 +206,14 @@ module.exports = function(RED) {
var limit = msg.limit;
if (typeof limit === "string" && !isNaN(limit)) {
limit = Number(limit);
} else if (typeof limit === "undefined") {
limit = 0;
}
var skip = msg.skip;
if (typeof skip === "string" && !isNaN(skip)) {
skip = Number(skip);
} else if (typeof skip === "undefined") {
skip = 0;
}
coll.find(selector,msg.projection).sort(msg.sort).limit(limit).skip(skip).toArray(function(err, items) {