Home > Software engineering >  How can I find data but ignore key data by nodejs express
How can I find data but ignore key data by nodejs express

Time:09-18

How can I find data but ignore key data by nodejs express and monogodb enter image description here

This is my code:

exports.getFileFromFolder = async (req, res, next) => {
  const storage = await Proof.find({ });
  if (!storage) {
    return next(new Error("404 not found"));
  }
  res.status(200).json({
    success: true,
    storage,
  });
};

CodePudding user response:

Use select method for projection.

  const storage = await Proof.find().select('name mimeType size parentId');
  • Related