Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check Item Does Not Exist? #73

Open
cmarx-cnnect opened this issue Oct 17, 2022 · 0 comments
Open

Check Item Does Not Exist? #73

cmarx-cnnect opened this issue Oct 17, 2022 · 0 comments
Labels
question Further information is requested

Comments

@cmarx-cnnect
Copy link

cmarx-cnnect commented Oct 17, 2022

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!

@samuk190 samuk190 added the question Further information is requested label Jun 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants