648 Commits

Author SHA1 Message Date
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
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
erdenezul
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
36aebffcc0 update changelog 2019-06-04 22:39:44 +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
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
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
b70ffc69df
Merge branch 'master' into bump_pymongo_version_requirement 2019-03-19 08:50:21 +08: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
Erdenezul Batmunkh
fb8c0d8fe3 Merge branch 'master' into draft_v017 2019-03-10 22:22:29 +08:00
Erdenezul Batmunkh
7b4245c91c Bump version 0.17.0 2019-03-10 21:16:58 +08:00
Bastien Gérard
9bd0d6b99d update changelog 2019-03-04 23:05:22 +01:00
Bastien Gérard
dca837b843 Add suport for Mongo 3.4 (travis, fix tests) 2019-02-26 21:38:23 +01:00
erdenezul
6b711da69d
Merge pull request #1998 from bagerard/Fix_update_full_result_documentation
Fix documentation of Queryset.update regarding full_result #1995
2019-02-19 17:16:42 +08:00
Bastien Gérard
57a38282a9 Add DeprecationWarning for EmbeddedDocument.save & .reload - those will be removed soon 2019-02-18 22:03:03 +01:00
erdenezul
2a121fe202
Merge branch 'master' into Fix_update_full_result_documentation 2019-02-18 09:31:00 +08:00
Bastien Gérard
e02261be6d add test coverage for #1557 2019-02-17 22:22:29 +01:00
Bastien Gérard
cab659dce6 Fix documentation of Queryset.update regarding full_result #1995 2019-02-16 21:54:05 +01:00
Eddie Linder
c6c68abfcc Update changelog and add another ut case 2019-01-11 19:23:47 +02:00
Tom Floyer
1319e422ea Updated docs/changelog.rst 2018-12-08 22:38:04 +03:00
Trevor Hall
d3b4af116e Add fix to changelog.rst #1965 2018-12-05 23:35:42 -06:00
Bastien Gérard
fcbabbe357 Fix but with save(write_concern=None) - introduced in 0.16.1 2018-11-21 00:03:08 +01:00
Erdenezul Batmunkh
8807c0dbef bump version 0.16.1 2018-11-14 17:10:17 +08:00
Bastien Gérard
e50799e9c4 Merge branch 'master' of github.com:MongoEngine/mongoengine into fix_cls_in_constructor 2018-11-13 21:48:16 +01:00
Bastien Gérard
c306d42d08 Fix bug #1733 of _delta method (Issue with DynamicDocument and default value) + add test case 2018-11-13 20:57:41 +01:00
Bastien Gérard
e31558318e BugFix - _cls not set in constructor #1950 2018-11-13 20:52:39 +01:00