File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed
Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -38,21 +38,25 @@ Use :class:`~django_mongodb_engine.fields.GridFSField` to store "nameless" blobs
3838besides documents that would normally go into the document itself.
3939
4040All that's kept in the document is a reference (an ObjectId) to the GridFS blobs
41- which is retrieved on demand.
41+ which are retrieved on demand.
4242
4343Assuming you want to store a 10MiB blob "in" each document, this is what you
4444*shouldn't * do::
4545
46+ # DON'T DO THIS
4647 class Bad(models.Model):
47- # DON'T DO THIS
48+ blob = models.TextField()
49+
50+ # NEITHER THIS
51+ class EventWorse(models.Model):
4852 blob = models.CharField(max_length=10*1024*1024)
4953
5054Instead, use :class: `~django_mongodb_engine.fields.GridFSField `::
5155
5256 class Better(models.Model):
5357 blob = GridFSField()
5458
55- A GridFSField may be feeded with anything that PyMongo can handle, that is,
59+ A GridFSField may be fed with anything that PyMongo can handle, that is,
5660(preferably) file-like objects and strings.
5761
5862You'll always get a :class: `~gridfs.grid_file.GridOut ` for documents from the
Original file line number Diff line number Diff line change @@ -26,9 +26,9 @@ and excluding data.
2626Perhaps a good way to get used to non-relational style data modeling is to ask
2727yourself "What would I never do in SQL".
2828
29- Because most relational databases lack proper list data structures you
30- may typically model the Posts ⇔ Tags ⇔ Comments relationship using three
31- models/tables, one table one table per entity type.
29+ Because most relational databases lack proper list data structures you may
30+ typically model the Posts ⇔ Tags ⇔ Comments relationship using three
31+ models/tables, one table per entity type.
3232
3333Organizing your data using multiple relationships is the exact opposite of what
3434we will do for our non-relational data model: Have one single collection (table)
You can’t perform that action at this time.
0 commit comments