Details
-
Task
-
Resolution: Done
-
Major - P3
-
None
-
None
Description
To retrieve a chunk from GridFS using the C++ legacy driver I need at minimum the following code:
GridFS gfs(client, "test", "db"); // 2x createIndex()
|
GridFile file = gfs.findFile(filename); // 1x findOne
|
GridFSChunk chunk = file.getChunk(); // 1x findOne
|
This has quite some overhead (3 extra queries) if I already have a client connection and know which chunk to retrieve.
Is there a way (except for writing my own custom query) to retrieve one chunk by performing only one Mongo query?
Can you explain me why the createIndex calls are necessary in the GridFS constructor?