Replies: 1 comment
-
Hello @hadmut. The The officially sanctioned way of getting at file data, which is supported by all of the official driver implementations, is to first query for the file using This two-step process is definitely not as convenient as what the older |
Beta Was this translation helpful? Give feedback.
-
Hi,
I'm currently learning to use MongoDB, using Ruby, and found some inconsistent detail.
The official Mongo Documentation for Ruby tells to use find_one() to find files.
in contrast, lib/mongo/grid/fs_bucket.rb tells
for find_one.
find() does return a list of meta documents describing the file, but there is no documented way to read the file contents when you have the meta document only.
Of course, it could be possible to use chunks = chunks_collection.find(:files_id => file_info[:_id]).sort(:n => 1) like the deprecated find_one did, but that's internals, and an API user should usually never use internals the documentation doesn't tell him to use, and it might be deprecated for reasons, so possible could be changed.
So what is the recommended, clean, and reliable way to get the file contents after calling find() ?
regards
Beta Was this translation helpful? Give feedback.
All reactions