Closed renatocassino closed 6 years ago
Hello guys.
I'm trying to make a query to search an ID in a list. I have a field called member_ids whith multiple ids.
I'm trying to make this: query = from m in MyModel, where: m.member_ids: [{"$exists": "588e25416e8dee2725c54446"}], select: m
query = from m in MyModel, where: m.member_ids: [{"$exists": "588e25416e8dee2725c54446"}], select: m
In MyModel I setted the field in this way field :members_ids, {:array, :string}
field :members_ids, {:array, :string}
How can I do this to work? Thanks for this.
You should be able to do
from m in MyModel, where: ^"588e25416e8dee2725c54446" in m.member_ids
Closing due to inactivity.
Hello guys.
I'm trying to make a query to search an ID in a list. I have a field called member_ids whith multiple ids.
I'm trying to make this:
query = from m in MyModel, where: m.member_ids: [{"$exists": "588e25416e8dee2725c54446"}], select: m
In MyModel I setted the field in this way
field :members_ids, {:array, :string}
How can I do this to work? Thanks for this.