Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow usage of schema reserved keywords #10414

Merged
merged 56 commits into from
Aug 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
be27aec
chore: use ecmaVersion 2018 in 6.0 branch to allow async/await
AbdelrahmanHafez Jul 2, 2021
a1d862e
test(document): assert possibility of using `validate` as a document …
AbdelrahmanHafez Jul 2, 2021
5722d05
fix(document): use Document#$validate internally instead of Document#…
AbdelrahmanHafez Jul 2, 2021
03cdcc7
lint: remove dangling commas
AbdelrahmanHafez Jul 2, 2021
67bf197
test(document): assert possibility of using `save` as a document prop…
AbdelrahmanHafez Jul 2, 2021
0270b51
fix(document): prefer $save over save internally
AbdelrahmanHafez Jul 2, 2021
c8af05b
remove schema reserved keys from #8869 in favor of #9010
AbdelrahmanHafez Jul 9, 2021
6969966
Merge branch '6.0' into gh-9010
AbdelrahmanHafez Jul 9, 2021
b403e72
test: assert ability of using isModified as a schema path re #9010
AbdelrahmanHafez Jul 9, 2021
11a7315
fix(document): allow using isModified as a schema path re #9010
AbdelrahmanHafez Jul 9, 2021
c861c7f
test(document): add tests asserting isNew can be used as a schema pat…
AbdelrahmanHafez Jul 9, 2021
980d6b0
test(document): assert that `populated` can be used as a schema path …
AbdelrahmanHafez Jul 9, 2021
6f352b4
fix(document): allow using `populated` as a schema path re #9010
AbdelrahmanHafez Jul 9, 2021
5d3eb79
revert schema reserved keys starting with $ changes to docs
AbdelrahmanHafez Jul 9, 2021
85ade36
revert schema reserved keys changes in docs
AbdelrahmanHafez Jul 9, 2021
e2a343b
test: assert toObject is usable as a schema path re #9010
AbdelrahmanHafez Jul 9, 2021
3deb806
fix: allow `toObject` as a path in documents, and use `$toObject` int…
AbdelrahmanHafez Jul 11, 2021
e925e2b
more converting toObject => $toObject re #9010
AbdelrahmanHafez Jul 11, 2021
965ef83
fix clone test cases
AbdelrahmanHafez Jul 11, 2021
9fe1409
fix typo causing infinite loop
AbdelrahmanHafez Jul 11, 2021
713909e
revert $toObject preference for internal usage
AbdelrahmanHafez Jul 11, 2021
a6a0a84
remove $toObject from clone test
AbdelrahmanHafez Jul 11, 2021
44b9910
prefer method.apply(this, arguments); over method()
AbdelrahmanHafez Jul 11, 2021
2746ba4
test(document): assert ability of using init as a schema path
AbdelrahmanHafez Jul 11, 2021
65587fa
prefer Document#$init over Document#init
AbdelrahmanHafez Jul 11, 2021
13d4096
fix model.$init re #9010
AbdelrahmanHafez Jul 11, 2021
d4641ce
fix failing tests
AbdelrahmanHafez Jul 11, 2021
7b4fa6d
add $collection to model prototype
AbdelrahmanHafez Jul 27, 2021
d403d85
test(document): assert ability of using `isNew` as a document property
AbdelrahmanHafez Jul 27, 2021
8360dd2
fix(document): allow using `isNew` as a schema path
AbdelrahmanHafez Jul 27, 2021
f814ff8
Merge branch '6.0' into gh-9010
AbdelrahmanHafez Jul 27, 2021
6500068
fix failing test re: #5078 #9010
AbdelrahmanHafez Jul 27, 2021
359f935
test(document): assert Document#errors can be used as a schema path
AbdelrahmanHafez Jul 27, 2021
f722c1d
fix(document): allow using `errors` as a schema path re #9010
AbdelrahmanHafez Jul 27, 2021
7452cc2
test(document): add test asserting ability to use `collection` as a s…
AbdelrahmanHafez Jul 27, 2021
c37f17b
dummy commit to trigger CI tests
AbdelrahmanHafez Jul 27, 2021
9f2809e
refactor tests re #9010
AbdelrahmanHafez Aug 4, 2021
4ca268c
fix failing tests
AbdelrahmanHafez Aug 4, 2021
8ed12a1
fix lint
AbdelrahmanHafez Aug 4, 2021
28595a1
Merge branch '6.0' into gh-9010
AbdelrahmanHafez Aug 4, 2021
254a610
test(document): assert ability to use `removeListener` as a schema path
AbdelrahmanHafez Aug 4, 2021
2d46fff
fix(document): allow using removeListener as a schema path re #9010
AbdelrahmanHafez Aug 4, 2021
c134994
test(document): assert ability of using `listeners` as a schema path
AbdelrahmanHafez Aug 4, 2021
f596418
fix(document): allow using `listeners` as a schema path re #9010
AbdelrahmanHafez Aug 4, 2021
7cba2dd
fix failing tests
AbdelrahmanHafez Aug 4, 2021
b655b27
test(document): assert ability of using `on` as a schema path
AbdelrahmanHafez Aug 4, 2021
51e2e7c
fix(document): allow using `on` as a schema path
AbdelrahmanHafez Aug 4, 2021
312d5c2
test(document): assert ability of using emit as a schema path
AbdelrahmanHafez Aug 4, 2021
e47936e
fix(document): allow using `emit` as a schema path re #9010
AbdelrahmanHafez Aug 4, 2021
22e3ec8
fix failing test
AbdelrahmanHafez Aug 4, 2021
984adb7
fix(document): allow using `get` as a schema path
AbdelrahmanHafez Aug 4, 2021
33bdb7c
fix(document): allow using `document` as a schema path re #9010
AbdelrahmanHafez Aug 4, 2021
30c4415
fix failing tests
AbdelrahmanHafez Aug 4, 2021
3a5189b
feat(schema): add warning when using a schema reserved path, and an o…
AbdelrahmanHafez Aug 4, 2021
41273a8
fix failing tests re #9010
AbdelrahmanHafez Aug 5, 2021
05bbdf1
run tests on all reserved properties
AbdelrahmanHafez Aug 5, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 1 addition & 4 deletions benchmarks/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,4 @@ run('array of docs', function() {
});
});

// console.error(a.toObject({depopulate:true}));
console.error('completed %d docs in %d seconds (%d dps)', numdocs, totaltime, numdocs / totaltime);

// --trace-opt --trace-deopt --trace-bailout
console.error('completed %d docs in %d seconds (%d dps)', numdocs, totaltime, numdocs / totaltime);
2 changes: 1 addition & 1 deletion lib/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ Connection.prototype.transaction = function transaction(fn, options) {
for (const doc of session[sessionNewDocuments].keys()) {
const state = session[sessionNewDocuments].get(doc);
if (state.hasOwnProperty('isNew')) {
doc.isNew = state.isNew;
doc.$isNew = state.$isNew;
}
if (state.hasOwnProperty('versionKey')) {
doc.set(doc.schema.options.versionKey, state.versionKey);
Expand Down
2 changes: 1 addition & 1 deletion lib/cursor/QueryCursor.js
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ function _create(ctx, doc, populatedIds, cb) {
{ populated: populatedIds } :
undefined;

instance.init(doc, opts, function(err) {
instance.$init(doc, opts, function(err) {
if (err) {
return cb(err);
}
Expand Down