Closed lykmapipo closed 7 years ago
Not sure if it works yet, but I suppressed this error by using:
const MySchemaWithSubdoc = Schema({
aSubdoc: {type: SomeOtherSchema}
})
@rwoody it is not supported at the moment. It does work with nested docs, just not schemas.
Also, this PR needs to have at minimum the latest tagged version but preferably master merged in. It also needs to be supported by test cases.
Let me know if you need help with that @lykmapipo
@lykmapipo I see that you did include tests; the tests dropped because as you'd left .only
on the new tests. I'll try to merge some of this. Thanks for the contribution :)
@mblarsen Gotcha. Does it work if the Schema also uses this mongoose plugin?
@rwoody I do not expect that to work, but you can try and let us know. v1.3 has been published to NPM with the Schema support from this PR.
@mblarsen My bad with only
flag on specs(tests). I will be eye open in other contributions.
@rwoody The PR I submitted only support single sub schema. I will try to extend to array of sub schema whenever possible and submit another PR.
@mblarsen Cheer.
Thanks for the update. I believe it is actually working for me (need to double check though) with something like:
const mySchema = mongoose.Schema({
tokens: {type: [TokenSchema], hideJSON: true}
})
edit: now that I typed that, I remembering that this issue was for hiding properties within the subschema (so TokenSchema
)
@rwoody nested schemas are supported now with 1.9
@all-contributors add @lykmapipo for bug, maintenance
@mblarsen
I've put up a pull request to add @lykmapipo! :tada:
Fix TypeError: Cannot read property 'type' of null at Object.keys.reduce (lib/mongoose-hidden.js:124:56)