This question is locked. New answers and comments are not allowed.
i have a multiple relation defined in my backend service, where i now want to check if the relation exists, thus the id is part of the array.
however, i can not find any solution that only provides me with the elements where the specified object is part of the relation.
i did search around and found the "$elemMatch" query type of mongoDB, but it seems that it is currently not supported?
therefore my current approach would be to get all object and check each relation via indexOf and discard any that i do not need/want.
but somehow this feels wrong to me, is there any other approach or solution that i currently overlook?
the only other solution i can think of is to define the relation in both ways and have it the other way around, but i kinda want to mitigate the need to keep it synchron and always update both relations
however, i can not find any solution that only provides me with the elements where the specified object is part of the relation.
i did search around and found the "$elemMatch" query type of mongoDB, but it seems that it is currently not supported?
therefore my current approach would be to get all object and check each relation via indexOf and discard any that i do not need/want.
but somehow this feels wrong to me, is there any other approach or solution that i currently overlook?
the only other solution i can think of is to define the relation in both ways and have it the other way around, but i kinda want to mitigate the need to keep it synchron and always update both relations