-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
SchemaArrayOptions looks emptier than other schema options #8389
Comments
The issue here is that See |
Hi @vkarpov15! |
@horvbalint out of curiousity, why not just get the array's embedded type using |
@vkarpov15 I am, thanks to your previous answer, but its meaning is not self-explanatory at first glance and it also means I have to pass the schema to my "processField" function to get the field's embedded type. Both of which would be better with $embeddedSchemaType 😄 |
feat(SchemaType): add getEmbeddedSchemaType() method to SchemaTypes
Do you want to request a feature or report a bug?
Looks like a bug, might be a feature.
What is the current behavior?
After creating some schemas, like this
I wanted to write a function which gets schema in JSON for frontend with +1 level deep with ref for ObjectId & ObjectId[] document properties, but there's no ref property in array options.
And this is what I get (I've omitted _id & __v in my func):
What is the expected behavior?
tags.options must contain custom attribute 'name' with value 'Tags'
likes.options must contain custom attribute 'name' with value 'Liked by' and ref attirubte with corresponded ref
I guess it can be fixed in lib\schema\array.js; in some point of function lifecycle there's
ref
oncast
andoptions
, but then it gets omitted.What are the versions of Node.js, Mongoose and MongoDB you are using? Note that "latest" is not a version.
node: v13.1.0
mongod: v4.2.1
mongoose: v5.7.13
The text was updated successfully, but these errors were encountered: