I'm very new to MongoDb and I want to try it with a small Flask project. And I picked a PyMongo. But I have no idea how to create a model. And can't find any information on this topic. So I try this:
app.config["MONGO_URI"] = "mongodb:///testdb"
mongo = PyMongo(app)
db = mongo.db
class Users(mongo.Document):
name = db.StringField()
lastname = db.StringField()
users = db.users
user = {
"name" : "A",
"lastname" : "B"
}
But it says that PyMongo does not have a 'Document' attribute. I'm not sure that it's a valid code for PyMongo but it worked with mongoengine. So how to I create a model with flask-pymongo? Thanks in advance!