Created
September 7, 2018 20:23
-
-
Save smartexpert/c4166ef216f9e53ad398b710524b9702 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let batch = db.batch | |
let docToWrite = { | |
stringField: "StringValue", | |
dateField: { | |
startDate: new Date('2018–09–07') | |
} | |
} | |
let setOptions = { merge: true } | |
batch.set(db.doc('users/user1'), docToWrite, setOptions} | |
if (change.before.exists && change.before.data().date.endDate.toDate()) { | |
let docToWrite2 = { field1: "dummyValue" } | |
batch.update(db.doc('resources/resource1'), docToWrite2) | |
return batch.commit() | |
} else { | |
return batch.commit() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment