Mathiasfc
Mathiasfc

Reputation: 1697

How to set a custom field when uploading an array with gridfs

I'm uploading an array of images with gridfs. I need to set a custom field to be able to get the images in the same order that they were organized in the application.

I can't simply sort by uploadDate because depending on the size of the image it may take more or less time to upload.

let formData = new FormData(form);
formData.append("imagem", this.filesToUpload);

controller:

router.post('/upload', upload.array('imagem'), function(req, res) {
  ...
});

I looked at the documentation - files.metadata but still could not get into any solution how to set the custom field.

Upvotes: 1

Views: 202

Answers (0)

Related Questions