diff --git a/src/collections/data/index.ts b/src/collections/data/index.ts index 2f90ab46..e498d910 100644 --- a/src/collections/data/index.ts +++ b/src/collections/data/index.ts @@ -69,9 +69,9 @@ export type UpdateObject = { /** The ID of the object to be updated */ id: string; /** The properties of the object to be updated */ - properties?: NonReferenceInputs; + properties?: Partial>; /** The references of the object to be updated */ - references?: ReferenceInputs; + references?: Partial>; //* The vector(s) to update in the object */ vectors?: number[] | Vectors; }; @@ -170,6 +170,13 @@ const addContext = ( return builder; }; +type ParseObject = { + id?: string; + properties?: Partial>; + references?: Partial>; + vectors?: number[] | Vectors; +}; + const data = ( connection: Connection, name: string, @@ -180,7 +187,7 @@ const data = ( const objectsPath = new ObjectsPath(dbVersionSupport); const referencesPath = new ReferencesPath(dbVersionSupport); - const parseObject = async (object?: InsertObject): Promise> => { + const parseObject = async (object?: ParseObject): Promise> => { if (!object) { return {} as WeaviateObject; } diff --git a/src/collections/serialize/index.ts b/src/collections/serialize/index.ts index 747bf00a..f7409b4e 100644 --- a/src/collections/serialize/index.ts +++ b/src/collections/serialize/index.ts @@ -1504,8 +1504,8 @@ export class Serialize { }; public static restProperties = ( - properties: Record, - references?: Record> + properties: Record, + references?: Record | undefined> ): Record => { const parsedProperties: any = {}; Object.keys(properties).forEach((key) => { @@ -1529,6 +1529,9 @@ export class Serialize { }); if (!references) return parsedProperties; for (const [key, value] of Object.entries(references)) { + if (value === undefined) { + continue; + } if (ReferenceGuards.isReferenceManager(value)) { parsedProperties[key] = value.toBeaconObjs(); } else if (ReferenceGuards.isUuid(value)) {