Merge pull request #19 from kunalkamble/patch-3

Add merge option while setting value
This commit is contained in:
Peter Svensson
2020-05-10 11:39:26 +02:00
committed by GitHub

View File

@ -14,10 +14,9 @@ module.exports = function(RED) {
if(msg && msg.payload){
console.log('firestore-set got input')
console.dir(msg)
const path = msg.payload.path
const obj = msg.payload.obj
const {path, obj, merge} = msg.payload
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.dir(res)
})
@ -27,4 +26,4 @@ module.exports = function(RED) {
}
RED.nodes.registerType("firestore-set", FirebaseAdmin);
}
}