attachmentFiles.chunks.ts 452 B

12345678910111213141516171819
  1. import { Binary } from 'mongodb';
  2. import { Types } from 'mongoose';
  3. import type { OverwriteParams } from '../import-settings';
  4. const { ObjectId } = Types;
  5. export const overwriteParams: OverwriteParams = {
  6. // ObjectId
  7. files_id: (value, { document, schema, propertyName }) => {
  8. return new ObjectId(value);
  9. },
  10. // Binary
  11. data: (value, { document, schema, propertyName }) => {
  12. return new Binary(Buffer.from(value, 'base64'));
  13. },
  14. };