Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 22 additions & 3 deletions src/collections/data/integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ describe('Testing of the collection.data methods with a single target reference'
const toBeUpdatedID = v4();
const toBeDeletedID = v4();
const nonExistingID = v4();
const deleteManyFirstID = v4();
const deleteManySecondID = v4();
const deleteManyThirdID = v4();

beforeAll(async () => {
client = await weaviate.connectToLocal();
Expand Down Expand Up @@ -78,9 +81,9 @@ describe('Testing of the collection.data methods with a single target reference'
id: toBeDeletedID,
});
return collection.data.insertMany([
{ properties: { testProp: 'DELETE ME' } },
{ properties: { testProp: 'DELETE ME' } },
{ properties: { testProp: 'DELETE ME' } },
{ properties: { testProp: 'DELETE ME' }, id: deleteManyFirstID },
{ properties: { testProp: 'DELETE ME' }, id: deleteManySecondID },
{ properties: { testProp: 'DELETE ME' }, id: deleteManyThirdID },
{
properties: {
testProp: 'EXISTING',
Expand Down Expand Up @@ -149,6 +152,22 @@ describe('Testing of the collection.data methods with a single target reference'
expect(obj).toBeNull();
});

it('should be able to dryRun delete many objects with a filter', async () => {
const result = await collection.data.deleteMany(
collection.filter.byProperty('testProp').equal('DELETE ME'),
{
dryRun: true,
verbose: true,
}
);
expect(result.failed).toEqual(0);
expect(result.matches).toEqual(3);
expect(result.successful).toEqual(3);
expect(result.objects.map((obj) => obj.id).sort()).toEqual(
[deleteManyFirstID, deleteManySecondID, deleteManyThirdID].sort()
);
});

it('should be able to delete many objects with a filter', async () => {
const result = await collection.data.deleteMany(
collection.filter.byProperty('testProp').equal('DELETE ME')
Expand Down
3 changes: 2 additions & 1 deletion src/collections/deserialize/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { stringify } from 'uuid';
import { WeaviateDeserializationError } from '../../errors.js';
import { Tenant as TenantREST } from '../../openapi/types.js';
import {
Expand Down Expand Up @@ -539,7 +540,7 @@ export class Deserialize {
objects: verbose
? reply.objects.map((obj) => {
return {
id: obj.uuid.toString(),
id: stringify(obj.uuid),
successful: obj.successful,
error: obj.error,
};
Expand Down
Loading