diff --git a/src/collections/data/integration.test.ts b/src/collections/data/integration.test.ts index 2aa2c3ee..7478ba74 100644 --- a/src/collections/data/integration.test.ts +++ b/src/collections/data/integration.test.ts @@ -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(); @@ -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', @@ -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') diff --git a/src/collections/deserialize/index.ts b/src/collections/deserialize/index.ts index 0b998d86..8982d723 100644 --- a/src/collections/deserialize/index.ts +++ b/src/collections/deserialize/index.ts @@ -1,3 +1,4 @@ +import { stringify } from 'uuid'; import { WeaviateDeserializationError } from '../../errors.js'; import { Tenant as TenantREST } from '../../openapi/types.js'; import { @@ -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, };