Tim
1
I have a mongo query with this match statement:
{
"$match": {
"$and": [
{
"gender": {
"$gte": 0.5
}
}
]
}
}
and it works just fine. However if I write this:
{
"$match": {
"$and": [
{
"gender": {
"$gte": "{{minGender}}"
}
}
]
}
}
And insert a 0.5 for the parameter minGender I get zero records back.
Why is it like that and can I fix this? Is this a bug?
arikfr
2
Change your query to be: (remove the quotes)
{
"$match": {
"$and": [
{
"gender": {
"$gte": {{minGender}}
}
}
]
}
}
Because otherwise the value of minGender
is treated as a string and hence returns no results.
Tim
3
If I do that, I get an error: bad string

Neither do single quotes work.
arikfr
4
And if you ignore this marker and just run the query?
Tim
5
Then no error is shown, but also no data appears.