@point-hub/papi
Version:
Point API Framework
23 lines • 834 B
TypeScript
type Primitive = string | number | boolean | null | undefined;
type Data = Primitive | DataObject | DataArray;
interface DataObject {
[key: string]: Data;
}
type DataArray = Array<Data>;
interface MongoUpdate {
$set?: Record<string, unknown>;
$unset?: Record<string, string>;
}
/**
* Compose MongoDB update operators ($set and $unset) based on input data.
* Fields with empty string or null values will be added to $unset,
* all other fields will be added to $set.
* Supports nested objects and arrays.
*
* @param data - Input object to transform
* @param parentKey - Internal key path prefix for recursion
* @returns MongoDB update object with $set and/or $unset
*/
export declare function composeUpdate(data: DataObject, parentKey?: string): MongoUpdate;
export {};
//# sourceMappingURL=mongodb-compose.d.ts.map