MongoDB in Flask
MongoDB is far and away the most popular NoSQL database. MongoDB is also the best-supported NoSQL database for Flask and Python in general. Therefore, our examples will focus on MongoDB.
MongoDB is a document store NoSQL database. Documents are stored in collections, which allow grouping of similar documents, but no similarities between documents are necessary to store a document in a collection. Documents are defined in a JSON superset named BSON, which stands for Binary JSON. BSON allows JSON to be stored in binary format rather than in string format, saving a lot of space. BSON also distinguishes between several different ways of storing numbers, such as 32-bit integers and doubles.
To understand the basics of MongoDB, we will use Flask-MongoEngine to cover the same functionality of Flask-SQLAlchemy in the previous chapters. Remember that these are just examples. There is no benefit in refactoring our current code to use MongoDB because MongoDB cannot offer any new functionality...