Filtering on a list of nested objects does not work
With a structure like this:
{ "_id": "foo",
"name": "bar",
"list_of_ids": [
"64c2c65384c9753d7d054c04"
],
"list_of_content_link": [
{
"_model": "myModel",
"_id": "64c2c654e8d2dd4142048aa1"
}
]
}
If I try to filter on the list of ids like this:
filter = {list_of_ids : "64c2c65384c9753d7d054c04"}
The filter does work, but if I tried to filter the list of content links like this:
filter = {"list_of_content_link._id" : list_of_content_link}
It always returns a 404.
I tried with multiple syntaxes and with mongo functions like $elemMatch but it does not work either.
It looks like you're using MongoLite as datastorage which doesn't support all mongodb query features.
I'll mark this issue as feature request to support querieng fields in an array of documents
No I'm using mongoDB, here is the docker image I'm using: image: mongo:4.4.6
Did you try:
filter = {
"list_of_content_link" : {"_id" : "64c2c65384c9753d7d054c04"}
}
?
Yes I tried, it returns a 500 :
Works for me 🤔 (mongodb version 6.0.3)
I upgraded my mongodb image to 6.0.3 and I still got an empty result, even if it should not :(
Might it be related to some configuration of the collection?
Also i'm using this version of cockpit: cockpithq/cockpit:core-2.6.1
Nevermind, I just noticed that my cockpit was not configured properly and was set to use mongolite instead of mongo.