Frustrated with Mongo and knime

Hi All

I have trying  to use Knime to get some data from our mongodb cluster, but I am getting more  and more frustrated with my  inability to get this working :-(

-In Knime 3.3, i was able to connect to mongodb and do simple search queries, but the implementation of the mongodb reader does not support filtering/searching for dates. I spend hours  reading and trying  jongo syntax  before posting  here by then, to learn that  that MongoDB reader does not support queries like {"d": new Date("2017/01/01")}.

-After upgrading to 3.5, I am unable to connect to the mongodb database, due to socket  error,  which  seems to be  a huge step back, but again searching in google and this forum provided a good answer; there is a bug  which prevent connect to mongodb databases if using SSL.

The suggestion I have got is just use the  java snippet to connect  and retrieve the info from mongo, but after searching for some examples, tutorials and so on, I have found nothing at all.

I am not a java developer and I have no clue about java (I know other languages but not java), can anyone point me to  a working  example for this? Just connect and retrieve one row or any query to a collection for anything? I can manage to do the rest.

Thanks! Knime is a great tool I am using with other DBs but for some reason, interacting  with mongodb is getting extremely difficult and frustrating.

 

Hi Emilio,

Jongo uses the MongoDB Extended JSON. Maybe inserting the date in the format YYYY-MM-DDTHH:mm:ss.mmm works?

 {"d": new Date("2017/01/01")} does not work because the "new Date()" command is JavaScript, not JSON. Can you try out  {"d": "2017-01-01"} or even {"d": "2017-01-01T00:00.000"}?

Kind regards,

Alexander

Thanks  Alex

It seems that your approach is valid, but I do not get any result from Mongo. I have moved from "Can not parse query" to launching the query and getting an "empty table" (Node created an empty data table).

 

Any ideas? Obviously there is data for  the query in the collection and I get it if I launch the query directly in mongo console.

Thanks very much!!!

Hi,

hmm, strange that this does not work. The only other idea I have is to put in a timestamp as number of milliseconds since 1970 directly, e.g.:

{"d": 1518103364000}

This is the type of number that "new Date()" and "Date.now()" in JavaScript produce, so it could work.

Kind regards,

Alexander

 

As with Querying Dates in MongoDB Reader, I’m still having issues querying on dates. Epoch, different formats, other helper functions (like $date, $humanTime, and $numberLong), everything is either returning no results, or a parser error. What’s the solution here?