Closed julb closed 9 years ago
Hi,
It can be useful to get the information of a file using its _id.
I did this in my method:
gfs.files.find({ _id: gfs.tryParseObjectId('54da7b013706c1e7ab25f9fa') }).toArray(function (err, files) { console.log(files[0]); });
It would be easier to write it like this: gfs.findOne({ _id: '54da7b013706c1e7ab25f9fa'}, function (err, file) { console.log(file); });
What do you think of this ?
This is added in v1.0.1 by @healiha
Thanks for the suggestion!
Hi,
It can be useful to get the information of a file using its _id.
I did this in my method:
gfs.files.find({ _id: gfs.tryParseObjectId('54da7b013706c1e7ab25f9fa') }).toArray(function (err, files) { console.log(files[0]); });
It would be easier to write it like this: gfs.findOne({ _id: '54da7b013706c1e7ab25f9fa'}, function (err, file) { console.log(file); });
What do you think of this ?