You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a problem with the filters of discriminators. I have read issues which looked like mine #9977 and tested several solutions but it is not working.
I want to push an element in an array property of discriminator and for that I need to filter with his type (the discriminator key) and his number.
Despite my tests, my new object is never added to my parent object.
Please find below the example I use:
VersionSchema contains an Array of object which are using discriminatorKey
Hereafter my test service to push a new item in my Array of elements using the discriminator (I cleaned the code, so I might not be accurate concerning the brackets). The aim here is to push a new subelement of an existing element in the array of the parent element. I need to use an array filter ($and) to find the element using the discriminator and to find the element with a specific number inside. Looks like the results get no answer for the update. I manually check, and the is one candidate for the update. What am I doing wrong here ?
vkarpov15
added
confirmed-bug
We've confirmed this is a bug in Mongoose and will fix it.
and removed
needs repro script
Maybe a bug, but no repro script. The issue reporter should create a script that demos the issue
labels
Dec 5, 2022
Prerequisites
Mongoose version
6.3.1
Node.js version
16.13.1
MongoDB version
5.0.9
Operating system
Windows
Operating system version (i.e. 20.04, 11.3, 10)
10
Issue
Hi to everyone,
I have a problem with the filters of discriminators. I have read issues which looked like mine #9977 and tested several solutions but it is not working.
I want to push an element in an array property of discriminator and for that I need to filter with his type (the discriminator key) and his number.
Despite my tests, my new object is never added to my parent object.
Please find below the example I use:
VersionSchema contains an Array of object which are using discriminatorKey
My test model for a diagram :
Hereafter my test service to push a new item in my Array of elements using the discriminator (I cleaned the code, so I might not be accurate concerning the brackets). The aim here is to push a new subelement of an existing element in the array of the parent element. I need to use an array filter ($and) to find the element using the discriminator and to find the element with a specific number inside. Looks like the results get no answer for the update. I manually check, and the is one candidate for the update. What am I doing wrong here ?
The text was updated successfully, but these errors were encountered: