PDA

View Full Version : MongoDB input query by ObjectId



pilotqx
02-18-2013, 07:46 PM
Hi,

I ran into a problem while running the following mongodb input step:

so here I want to do date range selection - everything from Dec 1, 2012. This query works without problems in mongo shell by kettle does not accept it.

10230

Here is the trace:

2013/02/18 18:39:24 - MongoDb Input.0 - ERROR (version 4.3.0-stable, build 16786 from 2012-04-24 14.11.32 by buildguy) : Unexpected error
2013/02/18 18:39:24 - MongoDb Input.0 - ERROR (version 4.3.0-stable, build 16786 from 2012-04-24 14.11.32 by buildguy) : com.mongodb.util.JSONParseException:
{'_id' : {'$gte' : ObjectId("50b98ed00000000000000000")}}
^

I see the JSON parser does not accept functions in query.

Is there a special way of writing it, so that it gets passed to mongodb server for execution?

ericsmith66
05-01-2013, 09:02 AM
I have the same issue, Did you ever find a solution?

Thanks
Eric Smith

yogesh_0586
12-19-2013, 02:42 AM
Hi,
change your query as below
{'_id' : {'$gte' : {'$oid': "50b98ed00000000000000000"}}}