diff --git a/docs/guide/index.rst b/docs/guide/index.rst index c4077888..46eb7af2 100644 --- a/docs/guide/index.rst +++ b/docs/guide/index.rst @@ -13,3 +13,4 @@ User Guide gridfs signals text-indexes + mongomock diff --git a/docs/guide/mongomock.rst b/docs/guide/mongomock.rst new file mode 100644 index 00000000..9471e94e --- /dev/null +++ b/docs/guide/mongomock.rst @@ -0,0 +1,21 @@ +============================== +Use mongomock for testing +============================== + +`mongomock `_ is a package to do just +what the name implies, mocking a mongo database. + +To use with mongoengine, simply specify mongomock when connecting with +mongoengine: + +.. code-block:: python + + connect('mongoenginetest', host='mongomock://localhost') + conn = get_connection() + +or with an alias: + +.. code-block:: python + + connect('mongoenginetest', host='mongomock://localhost', alias='testdb') + conn = get_connection('testdb)