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

bump serial port package

This commit is contained in:
Dave Conway-Jones 2017-01-09 20:53:43 +00:00
parent 83ea35d0dd
commit dcd2ede2c4
2 changed files with 14 additions and 10 deletions

View File

@ -1,9 +1,9 @@
{
"name" : "node-red-node-serialport",
"version" : "0.4.1",
"version" : "0.4.2",
"description" : "Node-RED nodes to talk to serial ports",
"dependencies" : {
"serialport" : "~4.0.3"
"serialport" : "~4.0.7"
},
"repository" : {
"type":"git",
@ -12,7 +12,7 @@
"license": "Apache-2.0",
"keywords": [ "node-red", "serial" ],
"node-red": {
"version": ">=0.13.0",
"version": ">=0.14.0",
"nodes": {
"serialport": "25-serial.js"
}

View File

@ -178,18 +178,19 @@ module.exports = function(RED) {
node.clientDb = db;
noerror = true;
var coll;
if (node.collection) {
coll = db.collection(node.collection);
}
node.on("input", function(msg) {
if (!node.collection) {
if (msg.collection) {
coll = db.collection(msg.collection);
} else {
}
else {
node.error(RED._("mongodb.errors.nocollection"));
return;
}
}
else {
coll = db.collection(node.collection);
}
var selector;
if (node.operation === "find") {
msg.projection = msg.projection || {};
@ -206,7 +207,8 @@ module.exports = function(RED) {
coll.find(selector,msg.projection).sort(msg.sort).limit(limit).skip(skip).toArray(function(err, items) {
if (err) {
node.error(err);
} else {
}
else {
msg.payload = items;
delete msg.projection;
delete msg.sort;
@ -220,12 +222,14 @@ module.exports = function(RED) {
coll.count(selector, function(err, count) {
if (err) {
node.error(err);
} else {
}
else {
msg.payload = count;
node.send(msg);
}
});
} else if (node.operation === "aggregate") {
}
else if (node.operation === "aggregate") {
msg.payload = (Array.isArray(msg.payload)) ? msg.payload : [];
coll.aggregate(msg.payload, function(err, result) {
if (err) {