Stefan Wojcik
b593764ded
One more changelog tweak [ci skip]
2019-07-02 18:35:29 +02:00
Stefan Wojcik
483c840fc8
One more changelog tweak [ci skip]
2019-07-02 18:29:28 +02:00
Stefan Wojcik
de80f0ccff
Clean up the changelog [ci skip]
...
Mostly making sure that code is formatted using backticks and that wording and
punctuation are consistent.
2019-07-02 18:28:04 +02:00
Stefan Wójcik and GitHub
d0b87f7f82
Drop the deprecated "format" param from BaseQuerySet.explain ( #2113 )
...
That option was pretty useless. You can very easily do:
```
import pprint
(...)
plan = SomeDoc.objects(...).explain()
pprint.pformat(plan)
```
2019-07-01 10:18:47 +02:00
Stefan Wójcik and GitHub
9170eea784
Rename MongoEngineConnectionError to ConnectionFailure ( #2111 )
...
I originally changed the exception name from `ConnectionError` to
`MongoEngineConnectionError` in
https://github.com/MongoEngine/mongoengine/pull/1428/commits/b02904ee750a30f8e2246a326376b40358543101 ,
inspired by landscape.io's package health report, which argued that
`ConnectionError` is already a built-in exception in Python 3 (which it is:
https://docs.python.org/3/library/exceptions.html#ConnectionError ).
I do agree that we shouldn't override built-in exceptions. [0] That said, it’s
silly to add a "MongoEngine" prefix to any class within the `mongoengine`
module (and *especially* to *just one* exception class out of many). I've
decided to do what PyMongo does (
https://github.com/mongodb/mongo-python-driver/blob/8855a510a80a30268ffd4b90be65fb26929648e2/pymongo/errors.py#L59 )
and call this exception `ConnectionFailure`.
Note that this is a breaking change and people will need to rename
`MongoEngineConnectionError`s in their code to `ConnectionFailure`. Moreover,
if they use PyMongo's `ConnectionFailure` for anything, they'll need to take
extra care to avoid conflicts, e.g. by using:
```
from mongoengine import ConnectionFailure as MongoEngineConnectionFailure
```
[0] Note that some popular packages still overwrite `ConnectionError`, e.g.
https://github.com/kennethreitz/requests/blob/4983a9bde39c6320aa4f3e34e50dac6e263dab6f/requests/exceptions.py#L32
or
https://github.com/andymccurdy/redis-py/blob/0be4d2920684345eb52115c7142c39d65356e7d4/redis/exceptions.py#L8
2019-06-30 09:23:32 +02:00
Stefan Wojcik
2769967e1e
Update the changelog [ci skip]
2019-06-27 17:41:29 +02:00
Stefan Wójcik and GitHub
b47669403b
Format the codebase using Black ( #2109 )
...
This commit:
1. Formats all of our existing code using `black`.
2. Adds a note about using `black` to `CONTRIBUTING.rst`.
3. Runs `black --check` as part of CI (failing builds that aren't properly formatted).
2019-06-27 13:05:54 +02:00
Stefan Wójcik and GitHub
ffedd33101
Drop support for positional arguments when instantiating a document ( #2103 )
...
For example, if you had the following class:
```
class Person(Document):
name = StringField()
age = IntField()
```
You could instantiate an object of such class by doing one of the following:
1. `new_person = Person('Tom', 30)`
2. `new_person = Person('Tom', age=30)`
3. `new_person = Person(name='Tom', age=30)`
From now on, only option (3) is allowed.
Supporting positional arguments may sound like a reasonable idea in this
heavily simplified example, but in real life it's almost never what you want
(especially if you use inheritance in your document definitions) and it may
lead to ugly bugs. We should not rely on the *order* of fields to match a given
value to a given name.
This also helps us simplify the code e.g. by dropping the confusing (and
undocumented) `BaseDocument._auto_id_field` attribute.
2019-06-26 11:31:11 +02:00
Stefan Wojcik
1ead7f9b2b
Add changelog entries for v0.18.2
2019-06-25 16:51:56 +02:00
Stefan Wojcik
8e69008699
Fill in the PR # in the changelog [ci skip]
2019-06-24 16:00:21 +02:00
Stefan Wojcik
f45552f8f8
Drop support for positional arguments when instantiating a document
...
For example, if you had the following class:
```
class Person(Document):
name = StringField()
age = IntField()
```
You could instantiate an object of such class by doing one of the following:
1. `new_person = Person('Tom', 30)`
2. `new_person = Person('Tom', age=30)`
3. `new_person = Person(name='Tom', age=30)`
From now on, only option (3) is allowed.
Supporting positional arguments may sound like a reasonable idea in this
heavily simplified example, but in real life it's almost never what you want
(especially if you use inheritance in your document definitions) and it may
lead to ugly bugs. We should not rely on the *order* of fields to match a given
value to a given name.
This also helps us simplify the code e.g. by dropping the confusing (and
undocumented) `BaseDocument._auto_id_field` attribute.
2019-06-24 15:44:35 +02:00
Stefan Wójcik and GitHub
ae0384df29
Improve Document.meta.shard_key docs ( #2099 )
...
This closes #2096 . Previous documentation of the shard_key meta attribute was
missing the crucial point that it really only matters if your collection is
sharded over a compound index.
2019-06-20 11:25:51 +02:00
Bastien Gérard
ca230d28b4
fix typo in changelog
2019-06-18 22:18:10 +02:00
Bastien Gérard
63c9135184
Bump version number and update changelog for 0.18.1
2019-06-17 22:36:54 +02:00
Bastien Gérard
5f00b4f923
refactor travis - mongo install and added python3.7
2019-06-13 22:50:19 +02:00
Stefan Wojcik
a6c04f4f9a
Finalize the v0.18.0 changelog [ci skip]
2019-06-12 11:38:58 +02:00
Bastien Gérard and Stefan Wójcik
4a8985278d
Document inherited members for the Document, EmbeddedDocument, DynamicDocument, and DynamicEmbeddedDocument ( #2040 )
2019-06-12 11:33:56 +02:00
erdenezul and GitHub
1f02d5fbbd
Merge pull request #1570 from erdenezul/remove_save_embedded
...
EmbeddedDocument should not have save method #1552
2019-06-11 16:15:53 +02:00
Erdenezul Batmunkh
c58b9f00f0
Add changelog
2019-06-11 15:53:50 +02:00
Stefan Wojcik
118a998138
Classify the QuerySet.aggregate change as a bugfix [ci skip]
2019-06-11 15:09:16 +02:00
Bastien Gérard
1fc5b954f2
fix typo in changelog
2019-06-10 22:38:37 +02:00
Stefan Wojcik
31d99c0bd2
Cleaner wording in the dev changelog
2019-06-10 11:26:47 +02:00
Bastien Gérard and GitHub
0ac59c67ea
Merge pull request #2068 from bagerard/fix_connection_auth_same_host
...
Fix connection issue when using different authentication in different dbs
2019-06-07 21:08:26 +02:00
Bastien Gérard
70d6e763b0
Document the custom field validation feature
2019-06-05 22:23:54 +02:00
Bastien Gérard and GitHub
5bf1dd55b1
Update mongomock example
...
Improved the mongomock example as reported in #2067
Fixes #2067
2019-06-04 22:56:52 +02:00
Bastien Gérard
36aebffcc0
update changelog
2019-06-04 22:39:44 +02:00
Bastien Gérard and GitHub
048a045966
Update connection/multiple databases docs
...
I observed that many people were confused by this so I thought I'd make the multiple databases example more explicit
2019-06-04 21:47:28 +02:00
Bastien Gérard
5fb0f46e3f
fix changelog (py37 not yet in travis)
2019-06-01 11:16:29 +02:00
Bastien Gérard
daca0ebc14
update changelog
2019-06-01 11:13:28 +02:00
Bastien Gérard
9ae8fe7c2d
Improve perf of Doc.save by preventing a full to_mongo() call just to get the created variable
2019-06-01 11:13:28 +02:00
Bastien Gérard
7d0687ec73
custom field validator is now expected to raise a ValidationError (drop support for returning True/False)
2019-05-28 09:26:07 +02:00
Bastien Gérard
2e01eb87db
Add support for MongoDB 3.6 and Python3.7 in travis
2019-05-18 14:29:42 +02:00
erdenezul and GitHub
ee85af34d8
Merge pull request #2043 from bagerard/fix_write_concern_in_save
...
Fix default write concern on save call that was overwriting connection WC
2019-05-15 15:26:50 +02:00
Bastien Gérard
9cdc3ebee6
Fix default write concern on save call that was overwriting connection wc
2019-05-05 23:37:12 +02:00
Bastien Gérard
f7b7d0f79e
Improve tests for querying list(embedded) when using inheritance
2019-05-03 21:59:48 +02:00
Bastien Gérard
d98f36ceff
Add test for querying on fields of list(EmbeddedDocument) (with inheritance on the EmbededDoc)
2019-05-02 00:08:16 +02:00
Bastien Gérard
abfabc30c9
Fix querying on (Generic)EmbeddedDocument subclasses fields
2019-05-01 23:23:19 +02:00
Bastien Gérard
e44f71eeb1
updated changelog
2019-04-25 22:31:05 +02:00
Bastien Gérard
cb578c84e2
Merge branch 'master' of github.com:MongoEngine/mongoengine into disconnect
2019-04-25 22:15:48 +02:00
Bastien Gérard
565e1dc0ed
minor improvements
2019-04-25 22:11:43 +02:00
Bastien Gérard
b1e28d02f7
Improve connect/disconnect
...
- document disconnect + sample of usage
- add more test cases to prevent github issues regressions
2019-04-24 22:44:07 +02:00
Bastien Gérard
d1467c2f73
Fix connect/disconnect functions
...
- expose disconnect
- disconnect cleans _connection_settings
- disconnect cleans cached collection in Document._collection
- re-connecting with the same alias raise an error (must call disconnect in between)
2019-04-24 22:41:56 +02:00
Bastien Gérard and GitHub
c439150431
Merge pull request #2031 from yandrieiev/fail_fast_when_invalid_db_name
...
Fail fast when db name is invalid
2019-04-10 22:50:29 +02:00
Bastien Gérard
9bb3dfd639
updated changelog for recent commits + improve tests
2019-04-07 23:05:55 +02:00
Yurii Andrieiev
b5213097e8
Fail fast when db name is invalid
...
Without this commit save operation on first document would fail instead of immediate failure upon connection attempt. Such later failure is much less obvious.
2019-04-07 23:21:12 +03:00
Gaurav Dadhania
fdcaca42ae
Do not keep calling _dereference on values if it has already been dereferenced.
2019-03-25 09:43:42 +05:30
erdenezul and GitHub
b70ffc69df
Merge branch 'master' into bump_pymongo_version_requirement
2019-03-19 08:50:21 +08:00
Bastien Gérard and GitHub
73b12cc32f
Merge pull request #2021 from pauloAmaral/fix_indices_sortedlist_embedded_document_list
...
Generate Unique Indices for SortedListField and EmbeddedDocumentListField
2019-03-18 18:23:28 +01:00
Paulo Amaral
ba6a37f315
Generate Unique Indices for SortedListField and EmbeddedDocumentListFields
2019-03-18 11:32:53 +00:00
Bastien Gérard
6f8be8c8ac
document change in changelog
2019-03-17 22:11:01 +01:00