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:
parent
f2cc2bb321
commit
c17aac3b66
@ -206,10 +206,14 @@ module.exports = function(RED) {
|
|||||||
var limit = msg.limit;
|
var limit = msg.limit;
|
||||||
if (typeof limit === "string" && !isNaN(limit)) {
|
if (typeof limit === "string" && !isNaN(limit)) {
|
||||||
limit = Number(limit);
|
limit = Number(limit);
|
||||||
|
} else if (typeof limit === "undefined") {
|
||||||
|
limit = 0;
|
||||||
}
|
}
|
||||||
var skip = msg.skip;
|
var skip = msg.skip;
|
||||||
if (typeof skip === "string" && !isNaN(skip)) {
|
if (typeof skip === "string" && !isNaN(skip)) {
|
||||||
skip = Number(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) {
|
coll.find(selector,msg.projection).sort(msg.sort).limit(limit).skip(skip).toArray(function(err, items) {
|
||||||
|
Loading…
Reference in New Issue
Block a user