While building an API, I need to match documents that contain pending
or active
values for the key status
.
When trying
args.status = {
$or: [
'active',
'pending'
]
}
I get an error: cannot use $or with string
However,
args.status = {
$in: [
'active',
'pending'
]
}
works just fine.
I would expect $or
to work here. Can someone provide context on the differences between the two and why Strings require $in
?