I'm building a conditional query (MongoDb).
Is there a function to verify if a string value is a valid ObjectID?
I'm building a conditional query (MongoDb).
Is there a function to verify if a string value is a valid ObjectID?
Hey @_andrew!
MongoDB accepts 24-digit hexadecimal strings as ObjectIDs, so you might have success with using something like {{ yourObjectID.match(/^[a-f\d]{24}$/i) }}
.
Let us know if that works?
Thank you! I was thinking there's a built-in function but you are right, a regex will work in my case