Skip to content

Commit 7842181

Browse files
authored
Using uuid.stringify to parse bytes from grpc message correctly (#333)
1 parent ef34c76 commit 7842181

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

src/collections/data/integration.test.ts

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ describe('Testing of the collection.data methods with a single target reference'
3030
const toBeUpdatedID = v4();
3131
const toBeDeletedID = v4();
3232
const nonExistingID = v4();
33+
const deleteManyFirstID = v4();
34+
const deleteManySecondID = v4();
35+
const deleteManyThirdID = v4();
3336

3437
beforeAll(async () => {
3538
client = await weaviate.connectToLocal();
@@ -78,9 +81,9 @@ describe('Testing of the collection.data methods with a single target reference'
7881
id: toBeDeletedID,
7982
});
8083
return collection.data.insertMany([
81-
{ properties: { testProp: 'DELETE ME' } },
82-
{ properties: { testProp: 'DELETE ME' } },
83-
{ properties: { testProp: 'DELETE ME' } },
84+
{ properties: { testProp: 'DELETE ME' }, id: deleteManyFirstID },
85+
{ properties: { testProp: 'DELETE ME' }, id: deleteManySecondID },
86+
{ properties: { testProp: 'DELETE ME' }, id: deleteManyThirdID },
8487
{
8588
properties: {
8689
testProp: 'EXISTING',
@@ -149,6 +152,22 @@ describe('Testing of the collection.data methods with a single target reference'
149152
expect(obj).toBeNull();
150153
});
151154

155+
it('should be able to dryRun delete many objects with a filter', async () => {
156+
const result = await collection.data.deleteMany(
157+
collection.filter.byProperty('testProp').equal('DELETE ME'),
158+
{
159+
dryRun: true,
160+
verbose: true,
161+
}
162+
);
163+
expect(result.failed).toEqual(0);
164+
expect(result.matches).toEqual(3);
165+
expect(result.successful).toEqual(3);
166+
expect(result.objects.map((obj) => obj.id).sort()).toEqual(
167+
[deleteManyFirstID, deleteManySecondID, deleteManyThirdID].sort()
168+
);
169+
});
170+
152171
it('should be able to delete many objects with a filter', async () => {
153172
const result = await collection.data.deleteMany(
154173
collection.filter.byProperty('testProp').equal('DELETE ME')

src/collections/deserialize/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { stringify } from 'uuid';
12
import { WeaviateDeserializationError } from '../../errors.js';
23
import { Tenant as TenantREST } from '../../openapi/types.js';
34
import {
@@ -539,7 +540,7 @@ export class Deserialize {
539540
objects: verbose
540541
? reply.objects.map((obj) => {
541542
return {
542-
id: obj.uuid.toString(),
543+
id: stringify(obj.uuid),
543544
successful: obj.successful,
544545
error: obj.error,
545546
};

0 commit comments

Comments
 (0)