MongoDBReader get object id

I just want the exact object id in the find query. What I get now is { “$oid” : “569639eac4aa4fcbb10e545d”} as the _id. I need the part “569639eac4aa4fcbb10e545d” only. Is there a way to get that in the MongoDbReader Output mapping itself?

Hi

The ‘_id’ contains an object called ObjectId. This is why you get ‘_id = {“$oid” : “…”}’. Unfortunately, the MongoDBReader is not capable to obtain the string representation of the ObjectId. There are three approaches. You can parse the returned _id yourself using Reformat component, or you can use JSONReader to parse it for you, or use MongoDBExecute component to get the string representation of the ObjectID directly from the database. I attached a simple example graph, where the above is shown.

Hope this helps.

I get it. Thank you Lukas Cholasta.