-
-
Notifications
You must be signed in to change notification settings - Fork 4k
Feature: Infer schema type automatically. #11487
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
Closed
mohammad0-0ahmad
wants to merge
62
commits into
Automattic:master
from
mohammad0-0ahmad-forks:master
Closed
Changes from all commits
Commits
Show all changes
62 commits
Select commit
Hold shift + click to select a range
b7f70f8
add tsafe package to devDependencies
mohammad0-0ahmad 8c891e4
create utilities-types helps to infer schema type
mohammad0-0ahmad 3c2fd6b
Make some changes that obtain schema type & create some tests
mohammad0-0ahmad c6b6324
Remove tsafe & rewrite related tests
mohammad0-0ahmad 9f30615
Reimplement auto DocType inference
mohammad0-0ahmad cc33fc2
Merge branch 'Automattic:master' into master
mohammad0-0ahmad d5f11c7
Make Model instance show correct type instead of "any"
mohammad0-0ahmad 083ce6f
Refact ApplyBasicQueryCasting type to make schema properties types vi…
mohammad0-0ahmad f33b24a
Make schema props type visible
mohammad0-0ahmad c3ae6c5
Make InferredSchemaType support nested schemas
mohammad0-0ahmad b7152f7
Make statics functions auto typed by supplying them to schema options
mohammad0-0ahmad e6aa4f1
Merge https://github.com/Automattic/mongoose
mohammad0-0ahmad 92fc04a
Merge branch 'Automattic:master'
mohammad0-0ahmad d5cbee3
Refact Schema & Model types
mohammad0-0ahmad 11b6bed
Refact some infer-doc-type import lines
mohammad0-0ahmad 6020771
Create some tests for Model functions
mohammad0-0ahmad d5059d5
Infer document instance methods from methods object supplied in schem…
mohammad0-0ahmad 8fe4262
Use auto infered docType as default type every where
mohammad0-0ahmad 9f4b974
Improve ResolvePathType ability to resolve correct type of types stri…
mohammad0-0ahmad 4a5d3fa
create & implement FlexibleObject & refact typos
mohammad0-0ahmad a57b871
create & implement FlexibleObject & refact typos
mohammad0-0ahmad e5e42b7
Merge branch 'master' of https://github.com/mohammad0-0ahmad-forks/mo…
mohammad0-0ahmad 6d4b08a
Merge branch 'master' of https://github.com/Automattic/mongoose
mohammad0-0ahmad 3e23cae
Delete AnyKeys type & refact create & insertMany types
mohammad0-0ahmad 15a9213
Support obtaining enum type
mohammad0-0ahmad 638a0b6
Support custom typeKey
mohammad0-0ahmad c938e1e
Refact previous commit
mohammad0-0ahmad ce0f299
Provide JSDoc comments for inferschematype types.
mohammad0-0ahmad bc62a77
Merge branch 'master' of https://github.com/Automattic/mongoose
mohammad0-0ahmad 6b424d4
Merge branch 'master' of https://github.com/Automattic/mongoose
mohammad0-0ahmad 8fe3bd2
chore: release 6.2.8
vkarpov15 2df2e8b
test: add coverage for #11480
vkarpov15 dc1ede2
date expires option - add unit, behavior, example
boly38 204495c
fix typo
AbdelrahmanHafez b621612
Merge pull request #11557 from boly38/patch-1
AbdelrahmanHafez 5127024
perf(document+model): make a few small optimizations re: #11380
vkarpov15 7f7735c
quick fix re: #103800
vkarpov15 f4a112b
style: fix lint re: #11380
vkarpov15 93dd492
add tsafe package to devDependencies
mohammad0-0ahmad 2743a05
create utilities-types helps to infer schema type
mohammad0-0ahmad 4ea70f0
Make some changes that obtain schema type & create some tests
mohammad0-0ahmad 8ce5c39
Remove tsafe & rewrite related tests
mohammad0-0ahmad 85e4c1c
Reimplement auto DocType inference
mohammad0-0ahmad 6961e1c
Make Model instance show correct type instead of "any"
mohammad0-0ahmad 0795b69
Refact ApplyBasicQueryCasting type to make schema properties types vi…
mohammad0-0ahmad 40cf9a0
Make schema props type visible
mohammad0-0ahmad 2139bce
Make InferredSchemaType support nested schemas
mohammad0-0ahmad 622071b
Make statics functions auto typed by supplying them to schema options
mohammad0-0ahmad 3c539a9
Refact Schema & Model types
mohammad0-0ahmad 3fc1cb7
Refact some infer-doc-type import lines
mohammad0-0ahmad f1c0a9c
Create some tests for Model functions
mohammad0-0ahmad b4c5e0a
Infer document instance methods from methods object supplied in schem…
mohammad0-0ahmad c9aec3a
Use auto infered docType as default type every where
mohammad0-0ahmad 818bac0
Improve ResolvePathType ability to resolve correct type of types stri…
mohammad0-0ahmad 239846e
create & implement FlexibleObject & refact typos
mohammad0-0ahmad 3696661
Delete AnyKeys type & refact create & insertMany types
mohammad0-0ahmad 86558a5
Support obtaining enum type
mohammad0-0ahmad 52551a9
Support custom typeKey
mohammad0-0ahmad 605a089
Refact previous commit
mohammad0-0ahmad 797e1dc
Provide JSDoc comments for inferschematype types.
mohammad0-0ahmad bc4953c
Merge branch 'master' of https://github.com/Automattic/mongoose
mohammad0-0ahmad f2f38f8
Merge branch 'master' of https://github.com/mohammad0-0ahmad-forks/mo…
mohammad0-0ahmad File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8485,4 +8485,12 @@ function pick(obj, keys) { | |
| } | ||
| } | ||
| return newObj; | ||
| } | ||
| } | ||
|
|
||
| describe('Check if statics functions that is supplied in schema option is availabe (m0_0a)', function() { | ||
| it('should give a static function back rather than undefined', function M0_0aModelJS() { | ||
| const testSchema = new mongoose.Schema({}, { statics: { staticFn() { return 'Returned from staticFn'; } } }); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. so do we add a new option? @vkarpov15 |
||
| const TestModel = mongoose.model('TestModel', testSchema); | ||
| assert.equal(TestModel.staticFn(), 'Returned from staticFn'); | ||
| }); | ||
| }); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.