Metadata-Version: 2.0
Name: MongoRouter
Version: 0.0.1
Summary: A routing package for Mongo DB
Home-page: http://www.mandrescu.co
Author: Michael
Author-email: mihai@mandrescu.co
License: MIT
Keywords: mongo pymongo database nosql
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Build Tools
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Requires-Dist: pymongo

MongoRouter
===========

A thin wrapper over pymongo to make code independent of the database model.

----

The purpose of this package is to make code code independent of the database model.
Consider this code:

```python
client = MongoClient(host="mymongohost.com")
```

```python
db = client["db_name"]
```

```python
col = db["col_name"]
```

```python
col.insert_thing({"some": "thing"})
```

Changing the client host, or the name of the data base, or even the name of the collection would involve
refactoring every instance of these calls.

This project aims to solve this problem by separating the routing.

Suppose the code looked like this:

```python
settings = {
    "routes": {
            "col_name": {
                "client": {
                    "host": "mymongohost.com",
                    "port": 27017
                },
                "db": "db_name",
                "col": "col_name"
            }
}
```

```python
router = MongoRouter(settings=settings)
```

```python
mongo_router.route("col_name").insert({"some": "thing"})
```

This would allow the host, database name and collection name to be changed independently of db calls, which would look
like this, always:

```python
mongo_router.route("col_name").insert({"some": "thing"})
```

Changing the data base model is as easy as changing a JSON.


