Updated docs and added fix for _types and positional operator
Bumped version to 0.6.2
This commit is contained in:
parent
4c67cbb4b7
commit
737cbf5f60
@ -2,7 +2,16 @@
|
|||||||
Changelog
|
Changelog
|
||||||
=========
|
=========
|
||||||
|
|
||||||
Changes in 0.6.x
|
Changes in 0.6.2
|
||||||
|
================
|
||||||
|
- Updated documentation for ReplicaSet connections
|
||||||
|
- Hack round _types issue with SERVER-5247 - querying other arrays may also cause problems.
|
||||||
|
|
||||||
|
Changes in 0.6.1
|
||||||
|
================
|
||||||
|
- Fix for replicaSet connections
|
||||||
|
|
||||||
|
Changes in 0.6
|
||||||
================
|
================
|
||||||
|
|
||||||
- Added FutureWarning to inherited classes not declaring 'allow_inheritance' as the default will change in 0.7
|
- Added FutureWarning to inherited classes not declaring 'allow_inheritance' as the default will change in 0.7
|
||||||
|
@ -26,7 +26,12 @@ name - just supply the uri as the :attr:`host` to
|
|||||||
|
|
||||||
connect('project1', host='mongodb://localhost/database_name')
|
connect('project1', host='mongodb://localhost/database_name')
|
||||||
|
|
||||||
|
ReplicaSets
|
||||||
|
===========
|
||||||
|
|
||||||
|
MongoEngine now supports :func:`~pymongo.replica_set_connection.ReplicaSetConnection`
|
||||||
|
to use them please use a URI style connection and provide the `replicaSet` name in the
|
||||||
|
connection kwargs.
|
||||||
|
|
||||||
Multiple Databases
|
Multiple Databases
|
||||||
==================
|
==================
|
||||||
|
@ -1371,8 +1371,15 @@ class QuerySet(object):
|
|||||||
write_options = {}
|
write_options = {}
|
||||||
|
|
||||||
update = QuerySet._transform_update(self._document, **update)
|
update = QuerySet._transform_update(self._document, **update)
|
||||||
|
query = self._query
|
||||||
|
|
||||||
|
# SERVER-5247 hack
|
||||||
|
remove_types = "_types" in query and ".$." in unicode(update)
|
||||||
|
if remove_types:
|
||||||
|
del query["_types"]
|
||||||
|
|
||||||
try:
|
try:
|
||||||
ret = self._collection.update(self._query, update, multi=multi,
|
ret = self._collection.update(query, update, multi=multi,
|
||||||
upsert=upsert, safe=safe_update,
|
upsert=upsert, safe=safe_update,
|
||||||
**write_options)
|
**write_options)
|
||||||
if ret is not None and 'n' in ret:
|
if ret is not None and 'n' in ret:
|
||||||
@ -1400,10 +1407,17 @@ class QuerySet(object):
|
|||||||
if not write_options:
|
if not write_options:
|
||||||
write_options = {}
|
write_options = {}
|
||||||
update = QuerySet._transform_update(self._document, **update)
|
update = QuerySet._transform_update(self._document, **update)
|
||||||
|
query = self._query
|
||||||
|
|
||||||
|
# SERVER-5247 hack
|
||||||
|
remove_types = "_types" in query and ".$." in unicode(update)
|
||||||
|
if remove_types:
|
||||||
|
del query["_types"]
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Explicitly provide 'multi=False' to newer versions of PyMongo
|
# Explicitly provide 'multi=False' to newer versions of PyMongo
|
||||||
# as the default may change to 'True'
|
# as the default may change to 'True'
|
||||||
ret = self._collection.update(self._query, update, multi=False,
|
ret = self._collection.update(query, update, multi=False,
|
||||||
upsert=upsert, safe=safe_update,
|
upsert=upsert, safe=safe_update,
|
||||||
**write_options)
|
**write_options)
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
%define srcname mongoengine
|
%define srcname mongoengine
|
||||||
|
|
||||||
Name: python-%{srcname}
|
Name: python-%{srcname}
|
||||||
Version: 0.6.1
|
Version: 0.6.2
|
||||||
Release: 1%{?dist}
|
Release: 1%{?dist}
|
||||||
Summary: A Python Document-Object Mapper for working with MongoDB
|
Summary: A Python Document-Object Mapper for working with MongoDB
|
||||||
|
|
||||||
|
@ -329,11 +329,11 @@ class QuerySetTest(unittest.TestCase):
|
|||||||
|
|
||||||
BlogPost(title="ABC", comments=[c1, c2]).save()
|
BlogPost(title="ABC", comments=[c1, c2]).save()
|
||||||
|
|
||||||
BlogPost.objects(comments__by="joe").update(inc__comments__S__votes=1)
|
BlogPost.objects(comments__by="jane").update(inc__comments__S__votes=1)
|
||||||
|
|
||||||
post = BlogPost.objects.first()
|
post = BlogPost.objects.first()
|
||||||
self.assertEquals(post.comments[0].by, 'joe')
|
self.assertEquals(post.comments[1].by, 'jane')
|
||||||
self.assertEquals(post.comments[0].votes, 4)
|
self.assertEquals(post.comments[1].votes, 8)
|
||||||
|
|
||||||
# Currently the $ operator only applies to the first matched item in
|
# Currently the $ operator only applies to the first matched item in
|
||||||
# the query
|
# the query
|
||||||
|
Loading…
x
Reference in New Issue
Block a user