GridFS chunk retrieval

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Done
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: API
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      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?

            Assignee:
            Unassigned
            Reporter:
            Joost Meijles
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: