Query MongoDB with a regex expression against an ObjectId
- ObjectId is not a string but a special type in MongoDB. You can not
query with a regex expression operator against a field that contains ObjectId's. - But... _id doesn't have to be an ObjectId, so what i would suggest is providing your own unique string as _id then you can use a regex
expression for querying.