Add merge option while setting value
This commit is contained in:
@ -14,10 +14,9 @@ module.exports = function(RED) {
|
|||||||
if(msg && msg.payload){
|
if(msg && msg.payload){
|
||||||
console.log('firestore-set got input')
|
console.log('firestore-set got input')
|
||||||
console.dir(msg)
|
console.dir(msg)
|
||||||
const path = msg.payload.path
|
const {path, obj, merge} = msg.payload
|
||||||
const obj = msg.payload.obj
|
|
||||||
console.log('storing '+obj+' at firestore path '+path)
|
console.log('storing '+obj+' at firestore path '+path)
|
||||||
this.admin.firestore().doc(path).set(obj).then((res)=>{
|
this.admin.firestore().doc(path).set(obj, { merge }).then((res)=>{
|
||||||
console.log('firestore set result '+res)
|
console.log('firestore set result '+res)
|
||||||
console.dir(res)
|
console.dir(res)
|
||||||
})
|
})
|
||||||
@ -27,4 +26,4 @@ module.exports = function(RED) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
RED.nodes.registerType("firestore-set", FirebaseAdmin);
|
RED.nodes.registerType("firestore-set", FirebaseAdmin);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user