DEV Community

Discussion on: Flask Rest API -Part:1- Using MongoDB with Flask

Collapse
engmsilva profile image
Marcelo Ribeiro da Silva

Great article,

I tried to make some changes to the parameters of the fields in the document, but it doesn't seem to have any effect

I removed the "required" parameter from the fields and there was no effect. How can changes be made to an existing document?

Collapse
paurakhsharma profile image
Paurakh Sharma Humagain Author

It's probably because when you give constrains to the field like required, mongodb creates an index for the field. So, to make the change take place you either have to delete the index or easier thing will be to delete the database (don't do that in production 😉)

Please let me know if deleting the index or the database solves your issue.

Collapse
engmsilva profile image
Marcelo Ribeiro da Silva

I had already tried to delete the bank and the index, but I was looking for an alternative to a document that cannot be deleted.