Closed SrBrahma closed 2 years ago
If it already exists, won't do nothing, no error is thrown. Else, the doc is created.
Here is how I am doing it right now, with transaction.
It just check if it already exists, if not, set().
I ain't sure if the !data?.data is required or just !data would do it.
!data?.data
!data
const userAuth = await auth.getUser(caller.uid); await transaction( ({ get }) => get(users, caller.uid), ({ data, set }) => { if (!data?.data) { return set(users, caller.uid, { // myData }); } }, );
I am no longer interested in this as my code has changed.
If it already exists, won't do nothing, no error is thrown. Else, the doc is created.
Here is how I am doing it right now, with transaction.
It just check if it already exists, if not, set().
I ain't sure if the
!data?.data
is required or just!data
would do it.