node-red-contrib-mongoql
Version:
MongoDB Query for Node-Red
51 lines (49 loc) • 1.91 kB
HTML
<script type="text/html" data-template-name="insertMany">
<div class="form-row">
<label for="node-input-name">Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-tips">
To use this node, you need to provide <code>msg.url</code> (string), <code>msg.db_name</code> (string), <code>msg.db_collection</code> (string) and <code>msg.payload</code> (json) on your function node or inject node.
</div>
</script>
<script type="text/html" data-help-name="insertMany">
<p>
<strong>About</strong><br/>
This node implement insertMany function from MongoDB Driver.<br/><br/>
To use this node, you need to provide <code>msg.url</code> (string), <code>msg.db_name</code> (string), <code>msg.db_collection</code> (string) and <code>msg.payload</code> (json) on your function node or inject node.<br/><br/>
<strong>Example (Function Node)</strong><br/>
msg.url = "mongodb://localhost:27017";<br/>
msg.db_name = "pos";<br/>
msg.db_collection = "product";<br/>
msg.payload = [{<br/>
 "name": "Carrot",<br/>
 "type": "Vegetables",<br/>
 "price": 2.47<br/>
},{<br/>
 "name": "Grape",<br/>
 "type": "Fruit",<br/>
 "price": 24.7<br/>
}];<br/>
return msg;
</p>
</script>
<script type="text/javascript">
RED.nodes.registerType('insertMany', {
category: 'MongoQL',
color: '#68B368',
defaults: {
name: {
value: ""
}
},
inputs: 1,
outputs: 1,
icon: "mongodb.png",
paletteLabel: 'insertMany',
align: 'left',
label: function () {
return this.name || "insertMany";
}
});
</script>