Files
meteor/packages/mongo/mongo_utils.js
2022-01-21 13:28:35 -04:00

12 lines
428 B
JavaScript

export const normalizeProjection = options => {
// transform fields key in projection
const { fields, projection, ...otherOptions } = options || {};
// TODO: enable this comment when deprecating the fields option
// Log.debug(`fields option has been deprecated, please use the new 'projection' instead`)
return {
...otherOptions,
...(projection || fields ? { projection: fields || projection } : {}),
};
};