mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
update to mongodb node to allow both save and insert.
This commit is contained in:
parent
488a039781
commit
c193779f67
@ -60,8 +60,9 @@
|
|||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label for="node-input-operation"><i class="icon-wrench"></i> Operation</label>
|
<label for="node-input-operation"><i class="icon-wrench"></i> Operation</label>
|
||||||
<select type="text" id="node-input-operation" style="display: inline-block; vertical-align: top;">
|
<select type="text" id="node-input-operation" style="display: inline-block; vertical-align: top;">
|
||||||
<option value=store>Store</option>
|
<option value=store>save</option>
|
||||||
<option value=delete>Delete</option>
|
<option value=insert>insert</option>
|
||||||
|
<option value=delete>remove</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row node-input-payonly">
|
<div class="form-row node-input-payonly">
|
||||||
|
@ -50,6 +50,11 @@ function MongoOutNode(n) {
|
|||||||
if (node.payonly) coll.save(msg.payload,function(err,item){ if (err){node.error(err);} });
|
if (node.payonly) coll.save(msg.payload,function(err,item){ if (err){node.error(err);} });
|
||||||
else coll.save(msg,function(err,item){if (err){node.error(err);}});
|
else coll.save(msg,function(err,item){if (err){node.error(err);}});
|
||||||
}
|
}
|
||||||
|
else if (node.operation == "insert") {
|
||||||
|
delete msg._topic;
|
||||||
|
if (node.payonly) coll.insert(msg.payload,function(err,item){ if (err){node.error(err);} });
|
||||||
|
else coll.insert(msg,function(err,item){if (err){node.error(err);}});
|
||||||
|
}
|
||||||
if (node.operation == "delete") {
|
if (node.operation == "delete") {
|
||||||
coll.remove(msg.payload, {w:1}, function(err, items){ if (err) node.error(err); });
|
coll.remove(msg.payload, {w:1}, function(err, items){ if (err) node.error(err); });
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user