我想从mongodb集合中获取Iso日期对象值。
下面是我的mongodb收藏
{
"_id" : ObjectId("55c4657f036499106cf73fae"),
"from" : "Administrator",
"subject" : " Exception details :: InternalSession",
"dateTs" : ISODate("2015-08-07T07:59:59.172Z")
}
我想获得dateTs列值,即iSODate。
以下是我的java代码:
while (requestsCursor.hasNext()) {
DBObject dbObject = requestsCursor.next();
JSONArray toArr = new JSONArray();
String from = (String) (dbObject.containsField(FROM) ? dbObject.get(FROM) : "-");
ISO8601DateFormat dT = (ISO8601DateFormat) dbObject.get("dateTs");
System.out.println("dateTs : "+dT);
}
我得到空值
请建议..