153 Commits

Author SHA1 Message Date
Ross Lawley
55e20bda12 Added slave_okay syntax to querysets.
* slave_okay (optional): if True, allows this query to be run against a replica secondary.
2011-06-06 14:35:46 +01:00
Ross Lawley
56f00a64d7 Added bulk insert method.
Updated changelog and added tests / query_counter tests
2011-06-06 12:37:06 +01:00
Colin Howe
40df08c74c Fix QuerySet.ensure_index for new index specs 2011-05-29 13:33:00 +01:00
Colin Howe
6f5bd7b0b9 Test needs a connection... 2011-05-26 18:54:52 +01:00
Ross Lawley
c903af032f Added inline_map_reduce functionality
Also added map_reduce method for calculating item_frequencies
Closes #183
2011-05-26 15:44:43 +01:00
Ross Lawley
97a1310344 Tweakin test 2011-05-26 11:11:00 +01:00
Alistair Roche
bf6f03a412 Improved MapFields setting 2011-05-25 17:25:39 +01:00
Ross Lawley
5ab13518db Added test confirming order_by reference field doesnt work 2011-05-25 13:50:52 +01:00
Ross Lawley
eb892241ee Added regression test for editting embedded documents
Closes #35
2011-05-25 13:31:01 +01:00
Ross Lawley
fac3f038a8 Added regression test for issue with unset and pop
Closes #118
2011-05-25 12:20:56 +01:00
Ross Lawley
60c8254f58 Tweaks to item_frequencies
Updated to use a ternary statement and added tests
Refs #124 #122

Thanks to @nickvlku for the code.
2011-05-25 11:10:42 +01:00
Ross Lawley
2ce70448b0 Merge branch 'dev' into pull_124 2011-05-25 09:54:56 +01:00
Ross Lawley
3246cf8bdd Merge pull request #177 from sbook/feature/update_lists
Added the ability to update individual items in ListFields.

Example: 
  
   Message.objects(pk=12).update(set__comments__5__body="Testing 123")
2011-05-24 06:13:10 -07:00
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
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
04953351f1 Merge branch 'feature/slicing_fields' into dev 2011-05-20 14:18:48 +01:00
Ross Lawley
5f53cda3ab Added regression test for #94 2011-05-20 10:55:01 +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
b3251818cc Added regression test for custom queryset ordering
Closes #126
2011-05-19 13:04:14 +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
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
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
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
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
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
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
Vincent Driessen
ad1aa5bd3e Add tests that need to be satisfied. 2010-12-05 22:24:28 -08:00
Vincent Driessen
62cc8d2ab3 Fix: redefinition of "datetime" from line 6. 2010-12-05 22:24:27 -08:00
Harry Marr
3a0523dd79 Fixed issue with unset operation 2010-12-05 21:43:04 +00:00
Harry Marr
cec8b67b08 Added test for unsetting fields 2010-12-05 20:47:24 +00:00
Deepak Thukral
b12c34334c added test case for issue 103 2010-11-18 20:44:51 +01:00
Ales Zoulek
66baa4eb61 QS.all_fields - resets previous .only() and .exlude() 2010-11-10 22:01:27 +01:00
Ales Zoulek
bda4776a18 added Queryset.exclude() + tests 2010-11-05 12:57:48 +01:00
Harry Marr
c6058fafed Merge branch 'dev' of github.com:hmarr/mongoengine into dev 2010-11-02 13:44:19 +00:00
Harry Marr
11950eabea Merge branch 'master' of http://github.com/aleszoulek/mongoengine into dev 2010-11-02 13:43:33 +00:00
Harry Marr
6b880aa8b3 Fixed order-then-filter issue 2010-11-01 00:43:30 +00:00
Ales Zoulek
a3830be4c9 QuerySet.only() supports subfields + tests 2010-10-28 01:13:24 +02:00
Rached Ben Mustapha
2560145551 add a failing test for the pagination bug 2010-10-19 22:23:08 +00:00