如何在Python中查询Gridfs对象中的字段
我在python中使用gridfs时遇到问题。我上传了json文件,但现在想查询文件中的数据。如何做到这一点。下面是我的代码示例如何在Python中查询Gridfs对象中的字段,python,mongodb,pymongo,gridfs,Python,Mongodb,Pymongo,Gridfs,我在python中使用gridfs时遇到问题。我上传了json文件,但现在想查询文件中的数据。如何做到这一点。下面是我的代码示例 from pymongo import MongoClient import gridfs client = <connection_string> db = client.testdb fs = gridfs.GridFS(db) result = db.fs.files.find({}) print(list(result)) print(re
from pymongo import MongoClient
import gridfs
client = <connection_string>
db = client.testdb
fs = gridfs.GridFS(db)
result = db.fs.files.find({})
print(list(result))
print(result)
使用gridfs如何查询fav_foods字段?这不受支持。GridFS处理(存储和检索)二进制数据,MongoDB中没有查询GridFS中存储的文件内容的规定。如果希望使用MQL,则需要将数据作为文档插入。ok,因此如果JSON大于16mb,则必须将其拆分为较小的文档,然后插入。GridFS只是用来向下拉整个文件/图像/音频吗?
{'name': 'andrew',
'age': 90
'fav_foods': ['pizza', 'cheeseburger']
}