Commit Graph
1050 Commits
Author SHA1 Message Date
Ross Lawley 7ecf84395a Improved DictFields
Allow searching multiple levels deep in DictFields
Allow DictField entries containing strings to use matching operators

Thanks again to @theojulien for the initial code #108
2011-05-24 14:07:58 +01:00
Ross Lawley 32bab13a8a Added MapField, similar to DictField
Similar to DictField except the value of each entry is always of a certain
(declared) field type.

Thanks again to @theojulienne for the code #108
2011-05-24 12:50:48 +01:00
Ross Lawley 088c40f9f2 Added Abstract Base Classes
Thanks to @theojulienne for the code :) #108
2011-05-24 12:30:12 +01:00
Alistair Roche 8427877bd2 Merge remote branch 'upstream/dev' into dev 2011-05-24 11:32:23 +01:00
Alistair Roche 118c0deb7a Fixed list-indexing syntax; created tests. 2011-05-24 11:31:44 +01:00
Ross Lawley 1126c85903 Added Custom Objects Managers
Managers can now be directly declared in a Document eg::

```python
    class CustomQuerySetManager(QuerySetManager):

        @staticmethod
        def get_queryset(doc_cls, queryset):
            return queryset(is_published=True)

    class Post(Document):
        is_published = BooleanField(default=False)
        published = CustomQuerySetManager()
```

Refactored the name of the `_manager_func` to `get_queryset` to mark it as
part the public API.  If declaring a Manager with a get_queryset method, it
should be a staticmethod, that accepts the document_class and the queryset.

Note - you can still use decorators in fact in the example below,
we effectively do the same thing as the first example and is much less verbose.

```python

    class Post(Document):
        is_published = BooleanField(default=False)

        @queryset_manager
        def published(doc_cls, queryset):
            return queryset(is_published=True)
```

Thanks to @theojulienne for the initial impetus and code sample #108
2011-05-24 11:26:46 +01:00
Ross Lawley 1b72ea9cc1 Fixed detection of unique=True in embedded documents.
Added some more test cases - thanks to @heyman for the initial
test case.

Closes #172
Refs #171
2011-05-20 16:09:03 +01:00
Ross Lawley 04953351f1 Merge branch 'feature/slicing_fields' into dev 2011-05-20 14:18:48 +01:00
Ross Lawley 07e71d9ce9 Regression test for collection names an primary ordering
Closes #91
2011-05-20 14:18:16 +01:00
Ross Lawley 5f53cda3ab Added regression test for #94 2011-05-20 10:55:01 +01:00
Ross Lawley 9260ff9e83 Updated docs and added a NotRegistered exception
For handling GenericReferences that reference documents that haven't
been imported.

Closes #170
2011-05-20 10:22:22 +01:00
Ross Lawley 08d1689268 Updated to handle the converntional api style for slicing a field
Added testcase to demonstrate embedded slicing as well.

Refs #167
2011-05-20 09:47:41 +01:00
Ross Lawley 40b69baa29 Implementing Write Concern
Added write_options dict to save, update, update_one and get_or_create.
Thanks to justquick for the initial ticket and code.

Refs #132
2011-05-19 16:49:00 +01:00
Ross Lawley b3251818cc Added regression test for custom queryset ordering
Closes #126
2011-05-19 13:04:14 +01:00
Ross Lawley da8a057ede Added test showing documents can be pickled
Refs #135
2011-05-19 12:41:38 +01:00
Ross Lawley efba9ef52a Merge remote branch 'srackham/gridfs-read-seek' into gridfs-read-seek 2011-05-19 10:14:51 +01:00
Ross Lawley fb61c9a765 Regression test for mysterious uniqueness constraint when inserting into mongoengine
Closes #143  Thanks to tfausak for the test case.
2011-05-19 09:55:34 +01:00
Ross Lawley 95c2643f63 Added test showing primary=True behaviour.
If you set a field as primary, then unexpected behaviour can occur.
You won't create a duplicate but you will update an existing document.

Closes #138
2011-05-18 20:31:28 +01:00
Ross Lawley fc2aff342b Unique indexes are created before user declared indexes
This ensures that indexes are created with the unique flag, if a user
declares the index, that would automatically be declared by the `unique_indexes`
logic.

Thanks to btubbs for the test case.
Fixes #129
2011-05-18 17:37:41 +01:00
Ross Lawley 371dbf009f Updated QuerySet to allow more granular fields control.
Added a fields method and tests showing the retrival of subranges of
List Fields.

Refs #167
2011-05-18 16:39:19 +01:00
Ross Lawley 7526272f84 Added test example of updating an embedded field
Closes #139
2011-05-18 12:27:33 +01:00
Ross Lawley 5cbc76ea81 Pep8 2011-05-18 12:26:51 +01:00
Ross Lawley 7ba40062d3 Fixes ordering with custom db field names
Closes #125
2011-05-18 12:18:33 +01:00
Ross Lawley 1a049ee49d Added regression test case for mongoengine/issues/155 2011-05-18 11:06:14 +01:00
Ross Lawley 31521ccff5 Added queryset clone support and tests, thanks to hensom
Fixes #130
2011-05-18 10:30:07 +01:00
Ross Lawley 378b52321b Merge commit '18baa2dd7a4e909169b694cb6ec36214c5a51506' 2011-05-18 09:17:05 +01:00
Ross Lawley 98436f271e Merge branch 'master' into dev 2011-05-18 08:13:58 +01:00
Matt Chisholm 6cf0cf9e7d slight reordering of test code for clarity 2011-05-10 12:31:31 +02:00
Matt Chisholm 608f08c267 Implement spherical geospatial query operators & unit tests
fixes https://github.com/hmarr/mongoengine/issues/163
2011-05-10 12:28:56 +02:00
Nick Vlku Jr c379ff883a Merge remote branch 'upstream/master' into dev 2011-05-10 00:13:15 -04:00
Matt Chisholm 3b7a8ce449 change comments to reflect that the geospatial queries use degrees, not miles 2011-05-09 22:29:27 +02:00
Ross Lawley f0277736e2 Updated queryset to handle latest version of pymongo
map_reduce now requires an output.
Reverted previous _lookup_field change, until a test case
is produced for the incorrect behaviour.
2011-05-09 10:22:37 +01:00
Анхбаяр Лхагвадорж 96dbeea171 Added __hash__, __ne__ with test. 2011-04-12 20:23:16 +08:00
Stuart Rackham 2c7469c62a Additional file-like behavior for FileField (optional size arg for read
method; fixed seek and tell methods for reading files).
2011-04-03 15:21:00 +12:00
Nick Vlku 6f7d7537f2 Added a test to verify that if a native JS function is put in as a tag, item_frequencies no longer fails (added the word 'watch' as a tag) 2011-03-06 18:59:29 -05:00
Harry Marr ce8b3ea0a1 Merge remote branch 'nvie/dev' into dev 2011-01-09 23:29:11 +00:00
Harry Marr 10c0b035ae Merge remote branch 'aleszoulek/dev' into dev 2011-01-09 23:19:41 +00:00
Harry Marr 37818d2d72 Merge branch 'dev' of https://github.com/alefnula/mongoengine into alefnula-dev 2011-01-09 21:00:03 +00:00
Harry Marr 357dd0e7cc Merge remote branch 'iapain/master' into dev 2011-01-09 20:52:39 +00:00
Vincent Driessen 07ef58c1a7 Rename delete_rule -> reverse_delete_rule. 2010-12-20 05:55:46 -08:00
Vincent Driessen 3b55deb472 Remove unused meta data. 2010-12-13 13:25:49 -08:00
Vincent Driessen 4d5164c580 Use multiple objects in the test.
This is to ensure only the intended subset is deleted and not all
objects.
2010-12-13 13:24:20 -08:00
Vincent Driessen 5b118f64ec Add tests for nullification and denial on the queryset. 2010-12-13 12:54:26 -08:00
Vincent Driessen 07dae64d66 More the deletion code over to the QuerySet object.
The Document object doens't have any delete_rule specific code anymore,
and leverages the QuerySet's ability to deny/cascade/nullify its
relations.
2010-12-13 12:36:24 -08:00
Viktor Kerkez 501f033712 Merge remote branch 'hmarr/dev' into dev 2010-12-11 01:40:28 +01:00
Vincent Driessen 20eb920cb4 Change test docstring. 2010-12-06 00:06:03 -08:00
Vincent Driessen b06d794854 Implementation of DENY rules. 2010-12-05 23:43:19 -08:00
Vincent Driessen f3da5bc092 Fix: potential NameError bug in test case. 2010-12-05 23:03:40 -08:00
Vincent Driessen ad1aa5bd3e Add tests that need to be satisfied. 2010-12-05 22:24:28 -08:00
Vincent Driessen dd21ce9eac Initial implementation of the NULLIFY rule. 2010-12-05 22:24:27 -08:00