Skip to content

Commit c03af4d

Browse files
committed
Merge branch 'master' of https://github.com/idoshr/mongoengine into Update_with_Aggregation_Pipeline
2 parents 10d3c51 + 811dc12 commit c03af4d

File tree

5 files changed

+9
-7
lines changed

5 files changed

+9
-7
lines changed

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,3 +262,4 @@ that much better:
262262
* Jan Stein (https://github.com/janste63)
263263
* Timothé Perez (https://github.com/AchilleAsh)
264264
* oleksandr-l5 (https://github.com/oleksandr-l5)
265+
* Ido Shraga (https://github.com/idoshr)

docs/changelog.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Development
1010
- EnumField improvements: now `choices` limits the values of an enum to allow
1111
- Fix deepcopy of EmbeddedDocument #2202
1212
- Fix error when using precision=0 with DecimalField #2535
13+
- Add support for regex and whole word text search query #2568
1314

1415
Changes in 0.23.1
1516
===========

docs/guide/defining-documents.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ dictionary containing a full index definition.
477477

478478
A direction may be specified on fields by prefixing the field name with a
479479
**+** (for ascending) or a **-** sign (for descending). Note that direction
480-
only matters on multi-field indexes. Text indexes may be specified by prefixing
480+
only matters on compound indexes. Text indexes may be specified by prefixing
481481
the field name with a **$**. Hashed indexes may be specified by prefixing
482482
the field name with a **#**::
483483

@@ -488,14 +488,14 @@ the field name with a **#**::
488488
created = DateTimeField()
489489
meta = {
490490
'indexes': [
491-
'title',
491+
'title', # single-field index
492492
'$title', # text index
493493
'#title', # hashed index
494-
('title', '-rating'),
495-
('category', '_cls'),
494+
('title', '-rating'), # compound index
495+
('category', '_cls'), # compound index
496496
{
497497
'fields': ['created'],
498-
'expireAfterSeconds': 3600
498+
'expireAfterSeconds': 3600 # ttl index
499499
}
500500
]
501501
}

mongoengine/fields.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,10 @@ def prepare_query_value(self, op, value):
162162
elif op == "regex":
163163
regex = value
164164

165-
# escape unsafe characters which could lead to a re.error
166165
if op == "regex":
167166
value = re.compile(regex, flags)
168167
else:
168+
# escape unsafe characters which could lead to a re.error
169169
value = re.escape(value)
170170
value = re.compile(regex % value, flags)
171171
return super().prepare_query_value(op, value)

mongoengine/queryset/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,7 @@ def with_id(self, object_id):
727727
return queryset.filter(pk=object_id).first()
728728

729729
def in_bulk(self, object_ids):
730-
""" "Retrieve a set of documents by their ids.
730+
"""Retrieve a set of documents by their ids.
731731
732732
:param object_ids: a list or tuple of ObjectId's
733733
:rtype: dict of ObjectId's as keys and collection-specific

0 commit comments

Comments
 (0)