Start a new topic
Answered

How to delete a referenced object from specific entity ?

Hi could you please help me? I have collection Libraries and Books. Libraries object has a set of Books objects. For example Library1 has three books (Book1,Book2,Book3), how can I delete referenced object Book1 from Library1?

Best Regards

Alex


Best Answer

Hi,


Once you have fetched Library1 object, you can just edit the property containing the array of books and remove the Book1 from there and then, update Library1 object. That will remove reference of Book1 from Library1.


FYI, Book1 would still exist in Books collection. If you want to delete Book1 from Books collection also, you will have to execute a delete query on Books collection with id value taken from Library1 object.


Does that answer your question?


Regards,

Wani

Kinvey Support


Answer

Hi,


Once you have fetched Library1 object, you can just edit the property containing the array of books and remove the Book1 from there and then, update Library1 object. That will remove reference of Book1 from Library1.


FYI, Book1 would still exist in Books collection. If you want to delete Book1 from Books collection also, you will have to execute a delete query on Books collection with id value taken from Library1 object.


Does that answer your question?


Regards,

Wani

Kinvey Support


1 person likes this

Yes.Thank you 

Login or Signup to post a comment