As below, type of 'stime' and 'etime' is 'Date' with millisecond:
{
"_id" : ObjectId("58d843dd4da8fc62c8c6a0bd"),
"stime" : ISODate("2017-03-26T22:21:34.923Z"),
"etime" : ISODate("2017-03-26T22:42:17.341Z"),
}
And I queried data like this:
data.names<-c("stime","etime")
mongo.data <- mongo(collection = "data_1",db = "data_test",
url = "mongodb://10.23.102.122:32800")
journey <- mongo.data$find(query = '{\"_id\" : {\"$oid\":\"58d843dd4da8fc62c8c6a0bd\"}}',
fields = paste('{\"_id\":true, ',
paste('\"',data.names,'\":true', collapse = ', ', sep=''),
'}', sep = ''))
But the data queried are UTC time-stamp without millisecond data:
> journey
_id stime etime
1 58d843dd4da8fc62c8c6a0bd 1490566894 1490568137
> format(as.POSIXct(unlist(journey[1,-1]), origin = "1970-01-01 00:00:00"), format="%Y-%m-%d %H-%M-%OS3")
stime etime
"2017-03-27 06-21-34.000" "2017-03-27 06-42-17.000"
So, how can I query the data with millisecond data?