added output ports for rtdb-push and firestore-add

This commit is contained in:
Peter Svensson
2019-06-22 16:02:14 +02:00
parent 782299982c
commit f9e47e2248
5 changed files with 8 additions and 4 deletions

View File

@ -29,6 +29,7 @@ input: {payload: {path: 'foo/bar'}, {some: 'object', foo: 17}}
Pushes the new object onto an array under the path
input: {payload: {path: 'foo/bar'}, {some: 'object', foo: 17}}
output: the url to the newly pushed data () something like "https://xxxx-1111.firebaseio.com/foo/quux/-LhzUELu7Vv4DCD16zTK")
## rtdb-query
Set up a reactive query for a path in the rtdb database.
@ -67,6 +68,7 @@ input: {payload: {path: 'foo/bar'}, {some: 'object', foo: 17}}
Adds the new object under the collection the path describes and assigns it a random id
input: {payload: {path: 'foo/bar'}, {some: 'object', foo: 17}}
output: The id of the new document
## firestore-query
Set up a reactive query for a collection in the firestore database.

View File

@ -8,7 +8,7 @@
cred: {value: "", type: 'firebase-config'}
},
inputs:1,
outputs:0,
outputs:1,
icon: "firebase-admin-icon.png",
label: function() {
return this.name||"firestore-add";

View File

@ -18,8 +18,9 @@ module.exports = function(RED) {
const obj = msg.payload.obj
console.log('storing '+obj+' at rtdb path '+path)
this.admin.firestore().collection(path).add(obj).then((res)=>{
console.log('firestore set result '+res)
console.log('firestore set result '+res.id)
console.dir(res)
node.send({payload:res.id})
})
}
}.bind(this));

View File

@ -8,7 +8,7 @@
cred: {value: "", type: 'firebase-config'}
},
inputs:1,
outputs:0,
outputs:1,
icon: "firebase-admin-icon.png",
label: function() {
return this.name||"rtdb-push";
@ -46,5 +46,5 @@
</script>
<script type="text/x-red" data-help-name="rtdb-push">
<p>A node that wraps the rtdb-push SDK</p>
<p>A node that wraps the rtdb-push SDK.</p>
</script>

View File

@ -20,6 +20,7 @@ module.exports = function(RED) {
this.admin.database().ref(path).push(obj).then((res)=>{
console.log('firebase set result '+res)
console.dir(res)
node.send({payload: res})
})
}
}.bind(this));