update storage nodes info style

This commit is contained in:
Dave Conway-Jones
2016-03-02 13:27:22 +00:00
parent b6116abce3
commit 86049c20cb
15 changed files with 75 additions and 67 deletions

View File

@@ -104,13 +104,18 @@
<p>A simple MongoDB output node. Can save, insert, update and remove objects from a chosen collection.</p>
<p>Save will update an existing object or insert a new object if one does not already exist.</p>
<p>Insert will insert a new object.</p>
<p>Save and insert either store <b>msg</b> or <b>msg.payload</b>.</p>
<p>Update will modify an existing object or objects. The query to select objects to update uses <b>msg.query</b> and the update to the element uses <b>msg.payload</b>.</p>
<p>Save and insert either store <code>msg</code> or <code>msg.payload</code>.</p>
<p>Update will modify an existing object or objects. The query to select objects to update uses <code>msg.query</code>
and the update to the element uses <code>msg.payload</code>.</p>
<p>Update can add a object if it does not exist or update multiple objects.</p>
<p>Remove will remove objects that match the query passed in on <b>msg.payload</b>. A blank query will delete <i>all of the objects</i> in the collection.</p>
<p>You can either set the collection method in the node config or on <b>msg.collection</b>. Setting it in the node will override <b>msg.collection</b>.</p>
<p>By default MongoDB creates an <i>_id</i> property as the primary key - so repeated injections of the same <b>msg</b> will result in many database entries.</p>
<p>If this is NOT the desired behaviour - ie. you want repeated entries to overwrite, then you must set the <b>msg._id</b> property to be a constant by the use of a previous function node.</p>
<p>Remove will remove objects that match the query passed in on <code>msg.payload</code>. A blank query will delete
<i>all of the objects</i> in the collection.</p>
<p>You can either set the collection method in the node config or on <code>msg.collection</code>. Setting it in the
node will override <code>msg.collection</code>.</p>
<p>By default MongoDB creates an <i>_id</i> property as the primary key - so repeated injections of the
same <code>msg</code> will result in many database entries.</p>
<p>If this is NOT the desired behaviour - ie. you want repeated entries to overwrite, then you must set
the <code>msg._id</code> property to be a constant by the use of a previous function node.</p>
<p>This could be a unique constant or you could create one based on some other msg property.</p>
<p>Currently we do not limit or cap the collection size at all... this may well change.</p>
</script>
@@ -195,12 +200,17 @@
<script type="text/x-red" data-help-name="mongodb in">
<p>Calls a MongoDB collection method based on the selected operator.</p>
<p>Find queries a collection using the <b>msg.payload</b> as the query statement as per the .find() function. Optionally, you may also (via a function) set a <b>msg.projection</b> object to constrain the returned fields, a <b>msg.sort</b> object, a <b>msg.limit</b> number and a <b>msg.skip</b> number.</p>
<p>Count returns a count of the number of documents in a collection or matching a query using the <b>msg.payload</b> as the query statement.</p>
<p>Aggregate provides access to the aggregation pipeline using the <b>msg.payload</b> as the pipeline array.</p>
<p>You can either set the collection method in the node config or on <b>msg.collection</b>. Setting it in the node will override <b>msg.collection</b>.</p>
<p>See the <a href="http://docs.mongodb.org/manual/reference/method/db.collection.find/" target="new"><i>MongoDB collection methods docs</i></a> for examples.</p>
<p>The result is returned in <b>msg.payload</b>.</p>
<p>Find queries a collection using the <code>msg.payload</code> as the query statement as per the .find() function.
Optionally, you may also (via a function) set a <code>msg.projection</code> object to constrain the returned
fields, a <code>msg.sort</code> object, a <code>msg.limit</code> number and a <code>msg.skip</code> number.</p>
<p>Count returns a count of the number of documents in a collection or matching a query using the
<code>msg.payload</code> as the query statement.</p>
<p>Aggregate provides access to the aggregation pipeline using the <code>msg.payload</code> as the pipeline array.</p>
<p>You can either set the collection method in the node config or on <code>msg.collection</code>. Setting it in
the node will override <code>msg.collection</code>.</p>
<p>See the <a href="http://docs.mongodb.org/manual/reference/method/db.collection.find/" target="new"><i>MongoDB
collection methods docs</i></a> for examples.</p>
<p>The result is returned in <code>msg.payload</code>.</p>
</script>
<script type="text/javascript">

View File

@@ -15,8 +15,7 @@ To run this you need a local MongoDB server running. For details see
Install
-------
Run the following command in the root directory of your Node-RED install.
Usually this is `~/.node-red` .
Run the following command in your Node-RED user directory - typically `~/.node-red`
npm install node-red-node-mongodb
@@ -25,39 +24,39 @@ Usage
Nodes to save and retrieve data in a local MongoDB instance.
###Input
### Input
Calls a MongoDB collection method based on the selected operator.
*Find* queries a collection using the **msg.payload** as the query statement as
*Find* queries a collection using the `msg.payload` as the query statement as
per the *.find()* function.
Optionally, you may also (via a function) set
- a **msg.projection** object to constrain the returned fields,
- a **msg.sort** object,
- a **msg.limit** number,
- a **msg.skip** number.
- a `msg.projection` object to constrain the returned fields,
- a `msg.sort` object,
- a `msg.limit` number,
- a `msg.skip` number.
*Count* returns a count of the number of documents in a collection or matching a
query using the **msg.payload** as the query statement.
query using the `msg.payload` as the query statement.
*Aggregate* provides access to the aggregation pipeline using the **msg.payload** as the pipeline array.
*Aggregate* provides access to the aggregation pipeline using the `msg.payload` as the pipeline array.
You can either set the collection method in the node config or on **msg.collection**.
Setting it in the node will override **msg.collection**.
You can either set the collection method in the node config or on `msg.collection`.
Setting it in the node will override `msg.collection`.
See the <a href="http://docs.mongodb.org/manual/reference/method/db.collection.find/" target="new">*MongoDB collection methods docs*</a> for examples.
The result is returned in **msg.payload**.
The result is returned in `msg.payload`.
###Output
### Output
A simple MongoDB output node. Can save, insert, update and remove objects from a chosen collection.
MongoDB only accepts objects.
Save and insert can either store **msg** or **msg.payload**. If msg.payload is
Save and insert can either store `msg` or `msg.payload`. If msg.payload is
selected it should contain an object. If not it will be wrapped in an object with a name of payload.
*Save* will update an existing object or insert a new object if one does not already exist.
@@ -65,19 +64,19 @@ selected it should contain an object. If not it will be wrapped in an object wit
*Insert* will insert a new object.
*Update* will modify an existing object or objects. The query to select objects
to update uses **msg.query** and the update to the element uses **msg.payload**.
to update uses `msg.query` and the update to the element uses `msg.payload`.
Update can add an object if it does not exist or update multiple objects.
*Remove* will remove objects that match the query passed in on **msg.payload**.
*Remove* will remove objects that match the query passed in on `msg.payload`.
A blank query will delete *all of the objects* in the collection.
You can either set the collection method in the node config or on **msg.collection**.
Setting it in the node will override **msg.collection**.
You can either set the collection method in the node config or on `msg.collection`.
Setting it in the node will override `msg.collection`.
By default MongoDB creates an **msg._id** property as the primary key - so
repeated injections of the same **msg** will result in many database entries.
By default MongoDB creates an `msg._id` property as the primary key - so
repeated injections of the same `msg` will result in many database entries.
If this is NOT the desired behaviour - ie. you want repeated entries to overwrite,
then you must set the **msg._id** property to be a constant by the use of a previous function node.
then you must set the `msg._id` property to be a constant by the use of a previous function node.
This must be done at the correct level. If only writing msg.payload then payload must contain the \_id property.
If writing the whole msg object then it must contain an \_id property.

View File

@@ -22,10 +22,10 @@
"count": "count",
"aggregate": "aggregate"
},
"tip": "<b> Tip:</b> If no collection is set, ensure <b>msg.collection</b> will contain the collection name",
"tip": "<b> Tip:</b> If no collection is set, ensure <code>msg.collection</code> will contain the collection name",
"errors": {
"nocollection": "No collection defined",
"missingconfig": "missing mongodb configuration"
}
}
}
}

View File

@@ -1,6 +1,6 @@
{
"name" : "node-red-node-mongodb",
"version" : "0.0.4",
"version" : "0.0.5",
"description" : "Node-RED nodes to talk to an Mongo database",
"dependencies" : {
"mongodb" : "1.4.29"