This extension is mainly for use Mongokit more naturally. To use this extension, define all your document classes inherited from flask_supmongokit.BaseDocument instead of the mongokit.Document

We don't want to always use connection.User.find_one() if we can just type User.find_one() as we know that User is registered with a certain database and collection, more over, we don't want to call the connection.register method every time we define a new document, SupMongokit did that for you behind the scene.

Actually, we can have the host name, port name, database name provided in the configuration object Use MONGODB_HOST,MONGODB_PORT,MONGODB_DATABASE in the config object. They all ship with a default value if not configured, host is 'localhost', port is 27017 by default and database name is 'default'

Last but not least, we'd like to give each document a default collection name based on the document name, conform to a certain rule. In SupMongokit, the rule is simple , underscore and pluralize the document's class name. And if you insist to give the database and collection name manually, you can do that in the way you do in Mongokit, define __collection__ and __database__ attribute in your document class

Supmongokit supports multi connections to different mongod instances if you need set up another connection , call the add_connection method with connectionname, host , port and an optional default dbname parameter. By default, Models will be registered to the default connection configured in your flask config object, to register some model to a certain connection you added, declare the __connection__ class field in your model with is the same as the parameter you pass in to the add_connection method so that Supmongokit will recognize it.

SupMongokit is perfectly compatible with Mongokit, the SupMongokit instance is just a wrapper around the Mongokit connection instance, you can use it as the raw Mongokit instance directly. So if you need more features not found in SupMongokit, feel happy to refer to MongoKit, even the native PyMongo driver for more advance usage.