In my flask app I am using MongoeEgine. I am trying to insert multiple documents into my places collection in my MongoDB.
My document class is defined as
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)
The last statement fails
x= places(a)
TypeError: __init__() takes exactly 1 argument (2 given)
I also tried to save this to my instance
places.insert(x)
places.save(x)
both fail. Please help.