diff --git a/djongo/__init__.py b/djongo/__init__.py index cdd507693089037fc729990d5ff75cb31b09796f..cac0d2672e149eca62d1604bfd51849faa961755 100644 --- a/djongo/__init__.py +++ b/djongo/__init__.py @@ -7,4 +7,4 @@ # * Renz Ladia # * thestick613 -__version__ = '1.3.2' +__version__ = '1.3.3' diff --git a/docs/docs/get-started.md b/docs/docs/get-started.md index 394bfd35f8a18e4d2ae7ce9efad73dad5060b29b..c326b607552cd36d6d1cdae039d0cf91247bd266 100644 --- a/docs/docs/get-started.md +++ b/docs/docs/get-started.md @@ -110,9 +110,54 @@ class Entry(models.Model): By setting `null=False, blank=False` in `EmbeddedField`, missing values are never stored. -<!-- + ## Using MongoDB fields + Nest a `dict` inside a model with the `EmbeddedField`. The `model_container` is used to describe the structure of the + data being stored. + +```python +from djongo import models +class Blog(models.Model): + name = models.CharField(max_length=100) + + class Meta: + abstract = True + +class Entry(models.Model): + blog = models.EmbeddedField( + model_container=Blog + ) + headline = models.CharField(max_length=255) + +e = Entry() +e.blog = { + 'name': 'Djongo' +} +e.headline = 'The Django MongoDB connector' +e.save() +``` + +Nest a `list` of `dict` inside a model for more complex data. + +```python +from djongo import models + +class Entry(models.Model): + blog = models.ArrayField( + model_container=Blog + ) + headline = models.CharField(max_length=255) + +e = Entry() +e.blog = [ + {'name': 'Djongo'}, {'name': 'Django'}, {'name': 'MongoDB'} +] +e.headline = 'Djongo is the best Django and MongoDB connector' +e.save() +``` + +<!-- ## Simplify complex queries ## Django Admin