she*_*158 5 collections bulkinsert mongodb pymongo mongodb-query
我正在按照教程http://api.mongodb.org/python/current/tutorial.html进行批量插入.但是,我收到了下面列出的错误.我错过了什么?reviews_array是一个json_array
client = MongoClient()
client = MongoClient('localhost', 27017)
db = client.is_proj
db_handle = db.reviews
self.db_handle.insert_many(reviews_array)
Run Code Online (Sandbox Code Playgroud)
错误:
TypeError: 'Collection' object is not callable. If you meant to call the 'insert_many' method on a 'Collection' object it is failing because no such method exists.
Run Code Online (Sandbox Code Playgroud)
在pymongo中,在V3.0之前,您可以使用insert
单文档和批量插入.如果传递文档,则执行单插入,如果传递不同的可迭代(列表,生成器),则执行批量插入.
insert_many()
在V3.0之前的pymongo中不存在.
在pymongo V3.0,他们引进了insert_many
和insert_one
,以及使用普通的insert
被弃用.
归档时间: |
|
查看次数: |
3284 次 |
最近记录: |