-
Notifications
You must be signed in to change notification settings - Fork 81
Open
Labels
questionFurther information is requestedFurther information is requested
Description
Hi there. I am stuck on how to check that an item does not exist. I would do the following using vanilla IndexDB like so:
const user_exists = db.transaction('user_data').objectStore('user_data').get(user.id);
user_exists.onsuccess = ()=> {
if (!user_exists.result) {
// Do the thing
}
}
How would I do so using LocalBase? I have tried the following but the error is never caught:
db.collection('user_data').doc({ id: user.id }).get().then(document => {
console.log(document)
}).catch(error => {
// Could do the thing here if this worked
})
Thank you!
bonatoc
Metadata
Metadata
Assignees
Labels
questionFurther information is requestedFurther information is requested