Hi @alisha_liu,
That is super strange, I’ve just run a test on a dummy collection.
First I printed 3 UUIDs:
const myCollection = client.collections.get('Animals');
const res = await myCollection.query.fetchObjects({limit: 3})
for (const item of res.objects) {
console.log(item.uuid)
}
Then, I took these 3 UUIDs to run the following delete command:
const itemsIdToDelete = [
"327e9b13-3ca8-4fdf-867d-5f8326160bc8",
"4452c466-8e38-421a-b4e6-5ccada98cdf6",
"548ccd40-acef-4cf2-99d2-afda5e665399",
]
const deleteResult = await myCollection.data.deleteMany(
myCollection.filter.byId().containsAny(itemsIdToDelete),
{
dryRun: true,
}
);
Which gave me the following response - indicating that it would have deleted 3 objects:
{
"took": 0.0006591000128537416,
"failed": 0,
"matches": 3,
"successful": 3
}
Versions
Can you share the version of your weaviate-client
and the weaviate
version?
You can check your weaviate version by running:
console.log((await client.getMeta()).version)
Check object count
Sometimes, it is easy to misspell collection name.
Can you check that myCollection
contains data, like this:
const myCollection = client.collections.get('Animals');
const overAll = await myCollection.aggregate.overAll()
console.log(`Object Count: ${overAll.totalCount}`)
Dynamicaly grab uuids
Can you run the following script, which dynamically grabs 3 UUIDs and then maps them to an array of IDs.
const res = await myCollection.query.fetchObjects({limit: 3})
const itemsIdToDelete = res.objects.map(o => o.uuid)
console.log(`UUIDs to delete:\n${JSON.stringify(itemsIdToDelete, null, 2)}`)
const deleteResult = await myCollection.data.deleteMany(
myCollection.filter.byId().containsAny(itemsIdToDelete),
{
dryRun: true,
}
);
console.log(JSON.stringify(deleteResult, null, 2))