The read () method of gridfs object in mongoengine can only read stream data once, and no similar seek () method is found!

  mongodb, question
  • Database: mongo
  • Tools: mongoengine
  • Business: read MD5 value and generate file.

To read the MD5 value, you need to read the gridfs object once.
To generate a file, the gridfs object needs to be read for the second time.
When the gridfs object is called the second time, gridfs.read() == “”
How can such problems be solved?

gridfs.gridout.md5
gridfs.gridout.content_type