How can I find data but ignore key data by nodejs express and monogodb
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');