added output ports for rtdb-push and firestore-add
This commit is contained in:
@ -29,6 +29,7 @@ input: {payload: {path: 'foo/bar'}, {some: 'object', foo: 17}}
|
|||||||
Pushes the new object onto an array under the path
|
Pushes the new object onto an array under the path
|
||||||
|
|
||||||
input: {payload: {path: 'foo/bar'}, {some: 'object', foo: 17}}
|
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
|
## rtdb-query
|
||||||
Set up a reactive query for a path in the rtdb database.
|
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
|
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}}
|
input: {payload: {path: 'foo/bar'}, {some: 'object', foo: 17}}
|
||||||
|
output: The id of the new document
|
||||||
|
|
||||||
## firestore-query
|
## firestore-query
|
||||||
Set up a reactive query for a collection in the firestore database.
|
Set up a reactive query for a collection in the firestore database.
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
cred: {value: "", type: 'firebase-config'}
|
cred: {value: "", type: 'firebase-config'}
|
||||||
},
|
},
|
||||||
inputs:1,
|
inputs:1,
|
||||||
outputs:0,
|
outputs:1,
|
||||||
icon: "firebase-admin-icon.png",
|
icon: "firebase-admin-icon.png",
|
||||||
label: function() {
|
label: function() {
|
||||||
return this.name||"firestore-add";
|
return this.name||"firestore-add";
|
||||||
|
|||||||
@ -18,8 +18,9 @@ module.exports = function(RED) {
|
|||||||
const obj = msg.payload.obj
|
const obj = msg.payload.obj
|
||||||
console.log('storing '+obj+' at rtdb path '+path)
|
console.log('storing '+obj+' at rtdb path '+path)
|
||||||
this.admin.firestore().collection(path).add(obj).then((res)=>{
|
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)
|
console.dir(res)
|
||||||
|
node.send({payload:res.id})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
cred: {value: "", type: 'firebase-config'}
|
cred: {value: "", type: 'firebase-config'}
|
||||||
},
|
},
|
||||||
inputs:1,
|
inputs:1,
|
||||||
outputs:0,
|
outputs:1,
|
||||||
icon: "firebase-admin-icon.png",
|
icon: "firebase-admin-icon.png",
|
||||||
label: function() {
|
label: function() {
|
||||||
return this.name||"rtdb-push";
|
return this.name||"rtdb-push";
|
||||||
@ -46,5 +46,5 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/x-red" data-help-name="rtdb-push">
|
<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>
|
</script>
|
||||||
@ -20,6 +20,7 @@ module.exports = function(RED) {
|
|||||||
this.admin.database().ref(path).push(obj).then((res)=>{
|
this.admin.database().ref(path).push(obj).then((res)=>{
|
||||||
console.log('firebase set result '+res)
|
console.log('firebase set result '+res)
|
||||||
console.dir(res)
|
console.dir(res)
|
||||||
|
node.send({payload: res})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
|||||||
Reference in New Issue
Block a user