You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The same problem, doesn't work with MongoDB. TypeError: 'Collection' object is not callable. If you meant to call the 'ensure_index' method on a 'Collection' object it is failing because no such method exists.
Is it correct code?
app=Flask(__name__)
client=MongoClient("mongodb://mongodb:27017/")
db=client["mydatabase"]
collection=db["mycollection"]
# Creating a uniqueness index for the "key" fieldcollection.create_index([("key", 1)], unique=True)
# flask-profiler configapp.config["flask_profiler"] = {
"enabled": app.config["DEBUG"],
"storage": {
"engine": "mongodb",
"MONGO_URL": "mongodb://mongodb:27017/",
"DATABASE": "mydatabase",
"COLLECTION": "mycollection",
},
}
PyMongo 4.x aready remove ensure_index(), should use create_index() or create_indexes().
https://pymongo.readthedocs.io/en/stable/migrate-to-pymongo4.html#id43
The text was updated successfully, but these errors were encountered: