Uploaded image for project: 'C++ Driver'
  1. C++ Driver
  2. CXX-769

GridFS chunk retrieval

    XMLWordPrintableJSON

Details

    • Icon: Task Task
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • None
    • None
    • API

    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?

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: