0

I want to delete a record where I don't have its path/key but I've its object property for example:

I've record in database like:

slots {
  slot 1 : {
     bookings: [
       objectPath : {
         bookingID: "adadasd"
       }    
     ]
  }
}

and I want to delete a single object from bookings array where bookingID === "adadasd"

1 Answer 1

1

If you want to delete a document, you must know its full path. If you don't know the path, you must first query for the document using the fields you know (for you, bookingID), then delete the document using ID in the snapshot of the document that your query found. There is not a single command to run that does both - Firestore does not offer an equivalent to a SQL "delete where" command.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.