Get data from mongoDB using ObjectId - MongoDb Reader

I have a mysql database wich stores api_product_ids for a large no of products.These api_product_ids are searched in the ObjectIds(_id) of a mongoDb collection to return certain fields mentioned in the ‘projection’.I have used a Mongo DB Reader component to do the same.the query attribute of the component has the following value
{
_id : ‘ObjectId(“@{api_product_id}”)’
}

The find action in Robomongo is perfectly returning the record with the corresponding api_product_id as its “_id”.But in clover the component is not returning anything and the graph execution also reaches completion.The component is returning results when other parameters are queried instead of _id(for eg:{ category : “medium” } when queried in the component returns all records with the corresponding category value).Is there some syntax for checking the above query.I personally think this is due to some problem in the query format.

I also tried hardcoding the query with a existing api_product_id in the mongoDB.

Hi Raphael,

You can use notation: {_id: {$oid: “53b0e84b72a0ec06118b45fd”}} in your Query property. I have taken this from http://docs.mongodb.org/manual/referenc … nded-json/

There is issue in our bug tracker to extend our documentation. See https://bug.javlin.eu/browse/CLO-5334 for details.

I hope this helps.

yea it worked ! thanks a lot :smiley: