Ross Lawley
83fff80b0f
Cleaned up dereferencing
...
Dereferencing now respects max_depth, so should be more performant.
Reload is chainable and can be passed a max_depth for dereferencing
Added an Observer for ComplexBaseFields.
Refs #324 #323 #289
Closes #320
2011-11-25 08:36:47 -08:00
Ross Lawley
e80144e9f2
Added multidb support
...
No change required to upgrade to multiple databases. Aliases are used
to describe the database and these can be manually registered or fall
through to a default alias using connect.
Made get_connection and get_db first class members of the connection class.
Old style _get_connection and _get_db still supported.
Refs: #84 #87 #93 #215
2011-11-22 08:01:14 -08:00
Ross Lawley
63c5a4dd65
Fixes saving document schemas that have changed
...
Ensures that form defaults which are documents are
automatically marked as changed, so schemas can evolve
without migration issues.
[#360 ]
2011-11-22 07:34:08 -08:00
Ross Lawley
0624cdd6e4
Fixes collection creation post drop_collection
...
Thanks to Julien Rebetez for the original patch
closes [#285 ]
2011-10-11 02:26:33 -07:00
Ross Lawley
f7fbb3d2f6
Relaxed field name checking on embedded documents
2011-09-20 03:45:11 -07:00
Ross Lawley
050542c29b
Added InvalidDocumentError
...
Ensures defined documents are valid and users don't override core methods
by accident.
fixes #275
2011-09-09 17:36:40 +01:00
Ross Lawley
1631788ab6
Now Raise an exception if subclasses are missing at querytime.
...
Beats returning None thanks to #aid for mentioning it on IRC
2011-08-24 13:37:39 +01:00
Ross Lawley
bda716ef9d
Improved update in test case for removing inheritance
2011-08-18 08:30:52 +01:00
Wilson Júnior
b76590dc01
more tests for embedded lists
2011-08-17 09:32:04 -03:00
Ross Lawley
3c8cbcfee7
Added tests for showing how to set embedded document indexes
...
refs #257
2011-08-16 16:50:50 +01:00
Wilson Júnior
331f8b8ae7
fixes dereference for documents (allow_inheritance = False)
2011-08-09 14:31:26 -03:00
Ross Lawley
3f3f93b0fa
Fixing delta bug for dict fields
2011-07-29 15:48:29 +01:00
Ross Lawley
ac72722e57
Fixing bug setting a value that equates to false
2011-07-22 13:51:11 +01:00
Ross Lawley
72995a4b3e
Fixed changing default values to False for embedded items
2011-07-13 16:06:40 +01:00
Ross Lawley
a4c197a83c
Added update() convenience method to a document
...
Thanks to @dcrosta for the initial code
[closes #229 ]
2011-07-13 14:15:46 +01:00
Ross Lawley
e079924632
Added extra test for update / update_one
...
[closes #231 ]
2011-07-12 14:43:21 +01:00
Ross Lawley
cace665858
_delta checking didn't handle db_field_names at all
...
Fixed and added tests, thanks to @wpjunior and @iapain for initial test cases
[fixes #226 ]
2011-07-12 10:20:36 +01:00
Ross Lawley
a2b0266e01
Merge branch 'dev' into indexpatches
2011-07-11 16:58:17 +01:00
Ross Lawley
0fb629e24c
Added cascading deletes
...
Also ensured that unsetting works when not the default value of a field
2011-07-11 16:01:48 +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
Ross Lawley
556e620c7a
Fixes recursion error when resetting changed fields
...
Fixes #214 - thanks to wpjunior for the test case
2011-07-01 08:44:46 +01:00
Ross Lawley
8e1d701c27
Fixed infinite recursion bug in _geo_indices()
...
Fixes #213 Thanks to joshink for the bug report
2011-06-30 10:32:05 +01: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
e3cd398f70
Changed default collection naming
...
Also added upgrade text
2011-06-20 14:00:06 +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
1b0323bc22
Added document mixin support
...
For extendable / reusable documents
Fixes #204
2011-06-20 09:44:53 +01:00
Ross Lawley
e04e5f42ef
Added test inheriting document from another file works
...
Closes #28
2011-06-20 08:46:40 +01:00
Ross Lawley
f3d265bbe0
Added to_dbref
...
Thanks to Ankhbayar for the initial code
Closes #202
2011-06-17 14:23:40 +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
cae3f3eeff
Fixes pickling issue with choice fields
...
Removes the dynamic __get_field_display partials before pickling
2011-06-16 12:50:45 +01:00
Ross Lawley
658b85d327
Inconsistent setting of '_cls' broke inherited document referencing
...
Fixes #199
2011-06-15 16:51:49 +01:00
Ross Lawley
0338ac17b1
Fixes multiple assignment issue preventing saves
...
Thanks to @wpjunior for the ticket and testcase
Also fixed bug in BaseList
fixes #195
2011-06-15 08:57:46 +01:00
Ross Lawley
0ed79a839d
Added delta tracking to documents.
...
All saves on exisiting items do set / unset operations only on changed fields.
* Note lists and dicts generally do set operations for things like pop() del[key]
As there is no easy map to unset and explicitly matches the new list / dict
fixes #18
2011-06-14 14:35:38 +01:00
Ross Lawley
fd7f882011
Save no longer tramples over documents now sets or unsets explicit fields.
...
Fixes #146 , refs #18
Thanks @zhangcheng for the initial code
2011-06-09 16:09:06 +01:00
Ross Lawley
602d7dad00
Improvements to Abstract Base Classes
...
Added test example highlighting what to do to migrate a class from
complex (allows inheritance) to simple.
2011-06-08 17:10:26 +01:00
Colin Howe
1fa47206aa
Support for sparse indexes and omitting types from indexes
2011-05-26 19:39:41 +01:00
Ross Lawley
088c40f9f2
Added Abstract Base Classes
...
Thanks to @theojulienne for the code :) #108
2011-05-24 12:30:12 +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
07e71d9ce9
Regression test for collection names an primary ordering
...
Closes #91
2011-05-20 14:18:16 +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
da8a057ede
Added test showing documents can be pickled
...
Refs #135
2011-05-19 12:41:38 +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
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
98436f271e
Merge branch 'master' into dev
2011-05-18 08:13:58 +01:00
Анхбаяр Лхагвадорж
96dbeea171
Added __hash__, __ne__ with test.
2011-04-12 20:23:16 +08: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