Context:
I’m using the weaviate-client
(v3.8.0) for JavaScriptand trying to perform a deleteMany
operation in a multi-tenant collection using the documented tenant
option.
Code That Fails:
const response = await collection.data.deleteMany(
collection.filter.byProperty('docId').containsAny(docIds),
{
tenant: tenantName
}
);
Error:
The client throws an error that no tenant was specified, even though it was provided in the argument.
Investigation:
Looking into the client source code at:
weaviate-client/dist/node/cjs/collections/data/index.js
The relevant code is:
deleteMany: (where, opts) =>
connection
.batch(name, consistencyLevel, tenant) // tenant is undefined here
.then((batch) =>
batch.withDelete({
filters: Serialize.filtersGRPC(where),
dryRun: opts?.dryRun,
verbose: opts?.verbose,
})
)
The issue is that tenant
is being passed to connection.batch(...)
, but it’s never assigned from opts
. So even if I provide opts.tenant
, it doesn’t get used.
Expected Fix:
The code should extract the tenant from the options like this:
const tenant = opts?.tenant;
or
.batch(name, consistencyLevel, opts?.tenant)
Please confirm if this is a known issue, or if I’m using the API incorrectly. Happy to provide more details or help test a fix.