SOLVED Pythonv4 can't .data.delete_many on referenced objects

Hi team, I’m trying to delete chunks associated with a doc.
Schema:

references=[ReferenceProperty(name="fromDoc", target_collection=DOC_NAME)],

both Chunk & Doc are multitenant collections

the following 3 approaches don’t work:

  • single tenant
chunks_del_result = self.schemas.chunks.with_tenant(
                tenant=tenant_id
            ).data.delete_many(
                where=Filter("fromDoc").equal(doc_id),
where=Filter("fromDoc").equal(doc_id),
                 .by_id().equal(doc_id),
                where=Filter.by_ref(link_on="fromDoc")
                .by_property("_id")
                .equal(doc_id),

all return something like:

DeleteManyReturn(failed=0, matches=0, objects=None, successful=0)

nevermind, realized that the bulk chunk deletion must precede doc deletion, otherwise they get unlinked

1 Like

Hi @tjh !

Thanks for sharing :hugs: