springfilter
springfilter copied to clipboard
Fixed bug on (is null/is not null) when using (and/or) with MongoDb
Hi @torshid @marcopag90,
I found a bug when using (and/or) with (is null/is not null) on MongoDb It works correctly when using (is null/is not null) by themselves.
Api input is
date < '2022-10-30T18:35:24.00Z' or date is null
Get the following query when combining it with and/or operators to mongodb
{
"$or": [
{
"date": {
"$lt": {
"$date": "2022-10-30T18:35:24Z"
}
}
},
{
"date": null
}
]
}
Should be
{
"$or": [
{
"date": {
"$lt": {
"$date": "2022-10-30T18:35:24Z"
}
}
},
{
"date": {
"$exists": false
}
}
]
}
Change to match (is empty/is not empty) because they don't have that problem. It's a bug in BsonNull.VALUE implantation, what I can gather.
//Nibell
:warning: 3 God Classes were detected by Lift in this project. Visit the Lift web console for more details.
Get the correct query when only using (is not null/is null)
Api input is
date is null
Get the following query to mongodb which is correct
{
"date": {
"$exists": false
}
}
Hi @Nibell
From what I have read here, using "$exists": true
will also bring results with null values which is not equivalent to is not null
. It seems that the current behavior is correct, what do you think?