【发布时间】:2015-11-18 00:52:48
【问题描述】:
例如,我的文档中有一个名为“x”的字段,其中包含一个巨大的字符串。我希望能够逐字阅读字符串。
client = pymongo.MongoClient("localhost", 27017)
db = client.clients
collection = db.unlabel_review
for post in collection.find():
documents.append(post)
所以这会返回整个 JSON 对象列表,并且在文档上调用某个索引将返回该文档。返回该文档的字段的语法是什么,例如返回“id”或字段“x”,其中 x 包含一个字符串?
直觉上,我想说
documents[1] -> returns whole JSON object so
documents[1][1] -> returns the first index of that JSON object, but this doesn't seem to work
感谢您的帮助:)
【问题讨论】:
标签: python json mongodb pymongo