I am trying to insert a document into mongodb from Neo4j using apoc, and the document contains a date that I need to be received in mongodb as a date type. Here is an example of what I am sending:
I do receive the document on mongodb, the date is a string, which makes sense (because of apoc.temporal.format) , but I want it to be of type date in mongodb.
I tried almost everything, and I am stuck
Any help is appreciated.
Thanks
I'm also facing date issues, but to perform a find with parameters within the query, like, "sent after this date". In MongoDB the documents do have the ISODate datatype.
I was able to use operators if I convert a stringified JSON to a map (with apoc), but still never been able to perform a date-related query:
call apoc.mongodb.find('localhost','convofier','recommender_ar',apoc.convert.fromJsonMap('{entry_created_at: {$gt: {$date: "2020-06-03T03:00:00"}}}'),{entry_created_at:1},null,true) yield value
return value
If I use an actual date time, like this:
call apoc.mongodb.find('localhost','convofier','recommender_ar',{entry_created_at: datetime("2020-06-03T03:00:00")},{entry_created_at:1},null,false) yield value
return value
I get
Failed to invoke procedure apoc.mongodb.find: Caused by: org.bson.codecs.configuration.CodecConfigurationException: Can't find a codec for class java.time.ZonedDateTime.
use localdatetime insteade of datetime. See below.
call apoc.mongodb.find('localhost','convofier','recommender_ar',{entry_created_at: localDatetime("2020-06-03T03:00:00")},{entry_created_at:1},null,false) yield value
return value
Unfortunately I haven't been able to run a query filtering by date, neither storing it. I ended up retrieving all records and filtering locally in Neo4j.
I'm using Neo4j 3.5, and MongoDB 3.6 drivers (though I do not have any of the Jackson ones you have )
I will play around with the drivers' versions and let you know.