Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-1738

Length field of gridfs files collection documents stored as Int32 instead of int64

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • 3.9
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None

      EDIT: Upon further reading, this is actually also a bug in the Go driver, as per the spec:

      Note: drivers SHOULD store length as Int64 and chunkSize as Int32 when creating new GridFS files. However, drivers MUST be able to handle existing GridFS files where the length and chunkSize fields might have been stored using a different numeric data type.

      In pymongo gridfs, the files collection documents are stored with length as an int32(at least when the length is small), but the gridfs spec defines the schema such that this this field should be an int64.

      This type mismatch can cause problems when reading gridfs files that were inserted by pymongo in a driver written in a statically typed language. 

      e.g. the go driver crashes when trying to decode the length field.

            Assignee:
            bernie@mongodb.com Bernie Hackett
            Reporter:
            patrick.freed@mongodb.com Patrick Freed
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: