item = db.WineImages.find_one({'id': id})
image = grid_fs.get(item['id'])
base64_data = codecs.encode(image.read(), 'base64')
image = base64_data.decode('utf-8')
You might wanna use object id in GridFs. fs.get_last_version('_id': (your variable for object id))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.