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

Fixes collection only being set by first message

This commit is contained in:
Anna Thomas 2014-11-17 10:31:54 +00:00
parent ca2ef7e71f
commit 6ba0d83778

View File

@ -48,8 +48,8 @@ module.exports = function(RED) {
} }
return selector; return selector;
} }
function MongoOutNode(n) { function MongoOutNode(n) {
RED.nodes.createNode(this,n); RED.nodes.createNode(this,n);
this.collection = n.collection; this.collection = n.collection;
@ -72,7 +72,7 @@ module.exports = function(RED) {
coll = db.collection(node.collection); coll = db.collection(node.collection);
} }
node.on("input",function(msg) { node.on("input",function(msg) {
if (!coll) { if (!node.collection) {
if (msg.collection) { if (msg.collection) {
coll = db.collection(msg.collection); coll = db.collection(msg.collection);
} else { } else {
@ -173,7 +173,7 @@ module.exports = function(RED) {
coll = db.collection(node.collection); coll = db.collection(node.collection);
} }
node.on("input", function(msg) { node.on("input", function(msg) {
if (!coll) { if (!node.collection) {
if (msg.collection) { if (msg.collection) {
coll = db.collection(msg.collection); coll = db.collection(msg.collection);
} else { } else {