Querying on Date in Mongo
I'm inserting a Mongo doc with the following time-stamp:
val format = new java.text.SimpleDateFormat("yyyyMMddHHmmss")
format.format(new Date()).toLong
Here's what the sectiolooks like from Mongo's shell:
"{Timestamp" : NumberLong("20130919161948")}"
Based on a few tests, it appears to me that I can simply compare 2
documents by Timestamp by simply checking > or < for the yyyyMMddHHmmss
format.
Please let me know if this time-stamp is OK for Mongo. Will I be able to
query with it?
No comments:
Post a Comment