233 Commits

Author SHA1 Message Date
Colin Howe
b91db87ae0 Pre and post bulk-insert signals 2011-09-09 19:17:40 +01:00
Ross Lawley
a6449a7b2c Updates to documentation in prep for 0.5 2011-09-09 05:45:56 -07:00
Ross Lawley
bc9a09f52e Document updates 2011-09-09 04:21:32 -07:00
Ross Lawley
d83d226396 Merge pull request #265 from dcrosta/keeptemp
Update docs for removal of keep_temp
2011-08-17 13:49:55 -07:00
Ross Lawley
f549d8c0bc Merge pull request #263 from johnarnfield/dev
Added polygon support and unit tests
2011-08-17 13:46:40 -07:00
Dan Crosta
10c30f2224 remove keep_temp from map_reduce
fixes #258
2011-08-17 16:44:40 -04:00
Ross Lawley
11621c6f5a Removed keeptemp from map_reduce as 0.5 requires pymongo 1.11
Closes #258
2011-08-17 21:38:46 +01:00
Ross Lawley
97ac7e5476 Remove old pymongo version checks
Closes #264
2011-08-17 21:34:35 +01:00
John Arnfield
10bc93dfa6 Commas help too :) 2011-08-17 20:15:47 +01:00
John Arnfield
88cb8f3963 left some conflict markers in - oops 2011-08-17 20:14:24 +01:00
John Arnfield
bd005575c4 Added geospatial polygon lookups & tests 2011-08-17 20:11:05 +01:00
Dan Crosta
5f05843403 prefer to use map-reduce to db.eval where possible 2011-08-16 08:20:06 -04:00
Ross Lawley
3f301f6b0f Finishing touches to where implementation - thanks to dcrosta
Refs #242
2011-08-16 10:32:21 +01:00
Dan Crosta
81b69648ef docstring for where() 2011-08-15 16:56:51 -04:00
John Arnfield
376ca717fa Added support for within_polygon for spatial queries 2011-07-30 22:01:24 +01:00
Dan Crosta
13afead9fb add where() method to QuerySet 2011-07-20 12:41:20 -04:00
Ross Lawley
7a3412dc13 Added helper for reseting the index cache 2011-07-13 09:54:41 +01:00
Leo Honkanen
7f0d3638ba guard against potentially destructive updates with no update parameters 2011-07-12 16:10:47 +03:00
Ross Lawley
2a8d001213 Improvements to indexes and efficiencies
Thanks to @dcrosta for the patches
closes #225
2011-07-11 17:02:23 +01:00
Ross Lawley
a2b0266e01 Merge branch 'dev' into indexpatches 2011-07-11 16:58:17 +01:00
Ross Lawley
1452d3fac5 Fixed item_frequency methods to handle null values
[fixes #216]
2011-07-11 16:50:31 +01:00
Dan Crosta
0847687fd1 don't create extra index on _types (fix #222)
mongodb will use an index that begins with _types to service queries
against _types, so the extra index is only needed if no other fields are
indexed in the document. to be safe, we explicitly check all indexes to
see if any begins with _types, and only then prevent creation of the
additional index on _types.
2011-07-11 10:15:55 -04:00
Dan Crosta
859de712b4 only create indexes on first collection access (fix #223) 2011-07-11 09:44:28 -04:00
Ross Lawley
87f486c4f1 Added select_related() and refactored dereferencing
Added a dereference class to handle both select_related
 / recursive dereferencing and fetching dereference.

Refs #206
2011-06-27 12:25:49 +01:00
Ross Lawley
14be7ba2e2 Added support for the $ positional operator
closes #205
2011-06-21 14:50:11 +01:00
Ross Lawley
08ba51f714 Updated geo_index checking to be recursive
Fixes #127 - Embedded Documents can declare geo indexes and have
them created automatically
2011-06-20 15:41:23 +01:00
Ross Lawley
f41c5217c6 Added a cleaner way to get collection names
Also handles dynamic collection naming - refs #180.
2011-06-20 11:48:12 +01:00
Ross Lawley
99f923e27f Fixed queryset repr mid iteration
Closes #144
2011-06-17 15:04:07 +01:00
Ross Lawley
5e7efcc8c2 Added 'hint' support, telling Mongo the proper index to use for the query.
Judicious use of hints can greatly improve query performance. When doing a query
on multiple fields (at least one of which is indexed) pass the indexed field as
a hint to the query. Hinting will not do anything if the corresponding index
does not exist.  The last hint applied to this cursor takes precedence over all
others.

Closes #203
2011-06-17 12:43:28 +01:00
Ross Lawley
5e8604967c Fixes for django Q query rendering bug
Ensures that the QNodes haven't already been processed
Fixes #185
2011-06-16 15:00:10 +01:00
Ross Lawley
967e72723b Added note to item_frequencies method.
Current implementation is relatively simple, for complex schemas
the user will have to write their own map reduce.
2011-06-15 14:55:38 +01:00
Ross Lawley
94cad89e32 Fixes to item_frequencies - now handles path lookups
fixes #194
2011-06-15 11:22:27 +01:00
Ross Lawley
4b9bacf731 Added ComplexBaseField
* Handles the efficient lazy dereferencing of DBrefs.
* Handles complex nested values in ListFields and DictFields
* Allows for both strictly declared ListFields and DictFields where the embedded
value must be of a field type or no restrictions where the values can be a mix
of field types / values.
* Handles DBrefences of documents where allow_inheritance = False.
2011-06-09 11:25:24 +01:00
Colin Howe
4174918476 Merge in upstream dev 2011-06-08 12:33:36 +01:00
Colin Howe
7c62fdc0b8 Allow for types to never be auto-prepended to indices 2011-06-08 12:20:58 +01:00
Ross Lawley
3c88faa889 Updated slave_okay syntax
Now inline with .timeout() and .snapshot().
Made them chainable - so its easier to use and added tests for cursor_args
2011-06-08 12:06:26 +01:00
Ross Lawley
d15f5ccbf4 Added _slave_okay to clone 2011-06-08 10:41:08 +01:00
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
1fa47206aa Support for sparse indexes and omitting types from indexes 2011-05-26 19:39:41 +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
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
Alistair Roche
305fd4b232 Fixed whitespace 2011-05-24 11:44:43 +01:00
Alistair Roche
fe5111743d Merge branch 'dev' into feature/update_lists
Conflicts:
	mongoengine/queryset.py
2011-05-24 11:33:44 +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
Alistair Roche
13935fc335 Merge branch 'dev' into feature/update_lists 2011-05-24 08:58:38 +01:00