Closed stevemenke closed 9 years ago
Dates are a problem with the mongo persistor since the data type is not natively supported on json. The reason i use dates is because that is a requirement for TTL indexes (the mechanism i use to keep the storage clean).
However this is a issue with the persistor itself see: vert-x/mod-mongo-persistor#53
Since the persistor does not fix it i cannot do much about it.
I get the following exception when I use the MongoDBSessionStore:
SEVERE: Exception in Java verticle java.lang.IllegalArgumentException: Document field names can't start with '$' (Bad Key: '$date') at com.mongodb.DBCollection.validateKey(DBCollection.java:1844) at com.mongodb.DBCollection._checkKeys(DBCollection.java:1812) at com.mongodb.DBCollection._checkValue(DBCollection.java:1827) at com.mongodb.DBCollection._checkKeys(DBCollection.java:1803) at com.mongodb.DBCollection._checkObject(DBCollection.java:1789) at com.mongodb.DBCollectionImpl.update(DBCollectionImpl.java:256) at com.mongodb.DBCollection.update(DBCollection.java:191) at org.vertx.mods.MongoPersistor.doUpdate(MongoPersistor.java:275) at org.vertx.mods.MongoPersistor.handle(MongoPersistor.java:157) at org.vertx.mods.MongoPersistor.handle(MongoPersistor.java:39) at org.vertx.java.core.eventbus.impl.DefaultEventBus$11.run(DefaultEventBus.java:951) at org.vertx.java.core.impl.DefaultContext$3.run(DefaultContext.java:175) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745)
It is caused by line 65 in MongoDBSessionStore. I believe this is because the mod-mongo-persister does not handle dates well. Either the persister needs fixed or don't store a date, just store the current time in milliseconds.