在我的烧瓶应用程序中,我使用的是MongoeEgine.我正在尝试将多个文档插入到我的MongoDB中的places集合中.
我的文档类定义为
class places(db.Document):
name = db.StringField(max_length=200, required=True)
loc = db.GeoPointField(required=True)
def __unicode__(self):
return self.name
a=[]
a.append({"name" : 'test' , "loc":[-87,101]})
a.append({"name" : 'test' , "loc":[-88,101]})
x= places(a)
Run Code Online (Sandbox Code Playgroud)
最后一个声明失败了
x= places(a)
TypeError: __init__() takes exactly 1 argument (2 given)
Run Code Online (Sandbox Code Playgroud)
我也尝试将其保存到我的实例中
places.insert(x)
places.save(x)
Run Code Online (Sandbox Code Playgroud)
都失败了.请帮忙.