-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Casting for DocumentArray#id() re: #1575 #15733
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
base: 8.20
Are you sure you want to change the base?
Changes from all commits
9c6c662
79adc2c
d2aaf37
ce7e016
4f5e752
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -83,7 +83,7 @@ describe('types.documentarray', function() { | |||||
| sub1.title = 'Hello again to all my friends'; | ||||||
| let id = sub1.id; | ||||||
|
|
||||||
| let a = new MongooseDocumentArray([sub1]); | ||||||
| let a = new MongooseDocumentArray([sub1], 'test', null); | ||||||
| assert.equal(a.id(id).title, 'Hello again to all my friends'); | ||||||
| assert.equal(a.id(sub1._id).title, 'Hello again to all my friends'); | ||||||
|
|
||||||
|
|
@@ -186,8 +186,23 @@ describe('types.documentarray', function() { | |||||
|
|
||||||
| a = new MongooseDocumentArray([sub]); | ||||||
| assert.equal(a.id(id).title, 'Hello again to all my friends'); | ||||||
| }); | ||||||
|
|
||||||
| it('#id with custom schematype (gh-15725)', function() { | ||||||
| const schema = new Schema({ _id: Number, name: String }); | ||||||
| const Subdocument = TestDoc(schema); | ||||||
|
|
||||||
| const sub1 = new Subdocument(); | ||||||
| sub1._id = 42; | ||||||
| sub1.title = 'Hello again to all my friends'; | ||||||
|
|
||||||
| const parentDoc = { $__: true, $__schema: new Schema({ subdocs: [schema] }) }; | ||||||
|
|
||||||
| const a = new MongooseDocumentArray([sub1], 'test', parentDoc); | ||||||
|
||||||
| const a = new MongooseDocumentArray([sub1], 'test', parentDoc); | |
| const a = new MongooseDocumentArray([sub1], 'subdocs', parentDoc); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldnt it still be
nullalready?