fogine/couchbase-odm

RefDocs are not deleted upon `remove` call

mreis92 opened this issue · 1 comments

What you are doing?

Call remove on an instance (any instance of a model)

Model.getById(id).then((model) => {
    return model.remove();
});

What do you expect to happen?

The document referenced by id to be removed, as well as every refDocs created.

What is actually happening?

Only the document being referenced is being deleted

Couchbase SDK version: 2.2.2
Couchbase Server version: 4.6.0 Community (Developer preview)
CouchbaseODM version/branch: master

Hey there! I've been going through the documentation, and there's no reference to whether the refDocs are removed or not... If this is a feature rather than a bug, do you any suggestions on how to get pass this? Thanks!

Hello @mreis92
there is actually destroy method for that.
The ModelInstance.remove is inherited from the Document prototype object method and indeed, by design, it does not remove any other documents except the main one.
I should have documented the inherited methods of Document prototype further. Will do it in official 2.0.0 release with couple of more upcoming guides. Thanks for letting me know.

Feel free to message me on gitter with any related questions.