We have an aggregation query in RestHeart which works well.
In the match
section, we allow users to specify a specific document Id, to return just that document:
"_$match" : {
"_id" : {
"_$var" : "n"
},
However, we've also like users to be able to omit this, and get all documents in the collection.
Is there any way to make avars
optional, or to specify a wildcard for that avar
? Currently if the user omits the avar, they get an error. And setting the avar
to null or an empty string literally matches those values.
I guess another alternative would be if there can be conditional logic in the aggregation query properties -- not sure if this is possible.
Thanks
Tom