Ross Lawley
112e921ce2
Syntax cleaning
2011-12-07 01:34:36 -08:00
Ross Lawley
8d2bc444bb
db_alias using in model, queryset, reference fields, derefrence.
2011-12-07 01:16:36 -08:00
Ross Lawley
9188f9bf62
Added custom cascade kwarg options
...
Allows the user to overwrite any default kwargs
Closes #295
2011-11-30 08:54:33 -08:00
Ross Lawley
beacfae400
Removed use of _get_subclasses favouring get_document
...
_get_subclasses not actually required and causes issues
where Base Classes aren't imported but dont actually
need to be.
Fixes #271
2011-11-30 07:55:33 -08:00
Ross Lawley
fdc385ea33
Allow dynamic data to be deleted
...
Fixes #374
2011-11-30 03:06:46 -08:00
Ross Lawley
e1bb453f32
Configurable cascading saves
...
Updated cascading save logic - can now add meta or pass
cascade to save(). Also Cleaned up reset changed fields logic
as well, so less looping
Refs: #370 #349
2011-11-28 06:51:17 -08:00
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
Wilson Júnior
3d817f145c
fixes for #315 issue
2011-10-12 18:28:40 -03: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
7b1860d17b
Fixes tree based circular references
...
Thanks to jpfarias for the fix.
Also normalised the other circular checks.
2011-10-10 09:16:32 -07:00
Sergey Chvalyuk
08288e591c
small optimizing fix
2011-10-03 05:16:17 -07:00
Ross Lawley
a7edd8602c
Added support for expando style dynamic documents.
...
Added two new classes: DynamicDocument and DynamicEmbeddedDocument
for handling expando style setting of attributes.
[closes #112 ]
2011-09-28 01:39:39 -07:00
Ross Lawley
bc9a09f52e
Document updates
2011-09-09 04:21:32 -07:00
Slavi Pantaleev
7913ed1841
Prevent double saving when doing a forced insert.
...
When doing save(force_insert=True) on a document missing an _id field,
the document was first getting inserted and then being saved a second
time.
Also refactatored the code a bit to make the intent
(insert/update/delta-update) cleaner, especially since
the `created` variable name was so confusing.
2011-07-30 00:52:37 +03: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
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
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
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
09c32a63ce
Fixes bug with appending post save - due to lists not being reset
2011-06-21 12:34:14 +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
f3d265bbe0
Added to_dbref
...
Thanks to Ankhbayar for the initial code
Closes #202
2011-06-17 14:23:40 +01:00
Ross Lawley
cb1dfdfac6
Fixes to signals
...
The sender is the class of the document not the instance - easier to
hook into
2011-06-14 16:56:04 +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
Colin Howe
aa32d43014
Pydoc update
2011-06-08 12:36:32 +01:00
Ross Lawley
c3a8840435
Blinker signals added
2011-05-24 20:27:19 +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
49c978ad9e
Merge remote branch 'upstream/master'
2011-05-09 09:01:19 +01:00
Gregg Lind
9c1ad5f631
Tiny spelling correction / clarification.
2011-05-04 18:01:06 -07:00
Vincent Driessen
620f4a222e
Don't check for DO_NOTHING in the delete rule registration method.
...
It is already checked before it is invoked. This saves the ugly import
of DO_NOTHING inside document.py.
2010-12-14 02:03:26 -08:00
Vincent Driessen
f30fd71c5e
Refactor: put the delete rule constants into the queryset module, too.
2010-12-13 13:42:01 -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
3c98a4bff5
Remove accidentally left behind debugging message.
2010-12-06 00:07:30 -08:00
Vincent Driessen
b06d794854
Implementation of DENY rules.
2010-12-05 23:43:19 -08:00
Vincent Driessen
d21434dfd6
Make the nullification an atomic operation.
...
This shortcut works now, since hmarr fixed the unset bug in dev.
2010-12-05 22:41:16 -08:00
Vincent Driessen
dd21ce9eac
Initial implementation of the NULLIFY rule.
2010-12-05 22:24:27 -08:00
Vincent Driessen
86233bcdf5
Added initial implementation of cascading document deletion.
...
The current implementation is still very basic and needs some polish.
The essence of it is that each Document gets a new meta attribute called
"delete_rules" that is a dictionary containing (documentclass,
fieldname) as key and the actual delete rule as a value. (Possible
values are DO_NOTHING, NULLIFY, CASCADE and DENY. Of those, only
CASCADE is currently implented.)
2010-12-05 22:24:27 -08:00
Steve Challis
67a9b358a0
Merge branch 'v0.4' of git://github.com/hmarr/mongoengine into v0.4
2010-09-29 23:39:09 +01:00
Steve Challis
b5eb3ea1cd
Added a Django storage backend.
...
- New GridFSStorage storage backend
- New FileDocument document for storing files in GridFS
- Whitespace cleaned up in various files
2010-09-29 23:36:58 +01:00
Nicolas Perriault
449f5a00dc
added a 'validate' option to Document.save() +docs +tests
2010-09-11 17:45:57 +02:00
blackbrrr
447f8d0113
MapReduceDocument.object works with custom primary keys. test included.
2010-03-17 11:31:17 -05:00
blackbrrr
f156da4ec2
bumped version
2010-03-17 00:50:44 -05:00
blackbrrr
9be6c41af7
map/reduce result objects now only have 'key', 'value', and 'object' properties; MapReduceDocument.key_object now returns proper Document subclass; added finalize with Reddit ranking simulation; MapReduceDocuments now yielded;
2010-02-12 14:39:08 -06:00
blackbrrr
5c311eefb1
fixed merge conflict in queryset test
2010-02-12 09:59:09 -06:00
blackbrrr
69d3e0c4b6
added map/reduce support via QuerySet.map_reduce. map_reduce operations respect query specs and ordering, but ordering is currently only applied to map/reduce collection. map/reduce may eventually require its own QuerySet to avoid slicing conflicts. results are returned as lists of MapReduceDocument objects, dynamic objects representing the query. tests and documentation included. considered in the neighborhood of 'good start'.
2010-02-09 14:56:15 -06:00
Harry Marr
89f505bb13
Removed pool_size from connect, minor tidyup
2010-02-04 01:44:52 +00:00
Florian Schlachter
69e9b5d55e
fixed unicode-bug; replaced str(err) with err.message
2010-02-02 21:44:11 +01:00
Florian Schlachter
73aff806f3
reset to master, keep working on the dirty-fields-patch in another branch
2010-01-31 18:00:01 +01:00
Florian Schlachter
bbfc2f416e
keep track of dirty fields is still work in progress; EmbeddedDocuments still aren't tracked (TBD)
2010-01-31 15:43:40 +01:00