Mongo Aggregate can not use ObjectID

I have a problem that I can not aggregate match when _id filed in my collection is ObjectID.
And in my pipeline agg, I have a match operator like:
[…, { “$match”: { “_id”: “an id” } }, …].
I see mongo agg node does not support for this case.
I can work around by add a setField pipeline before that add a new field idStr and convert it to string.
But this way is so bad because it add field to all records of collection, and on top of that, I can not make use of the power of index.
Do anybody have some ideas to resolve it?
I think this node should support convert string to ObjectID.

Thanks

2 Likes

can you share your workflow?