lua-resty-mongol
lua-resty-mongol copied to clipboard
Mongo Date type supported?
It seems there is a issue inserting Date type.
For instance, I have a code to create new user with created_at field.
local mongo = require "resty.mongol"
local bson = require "resty.mongol.bson"
local now = bson.get_utc_date(ngx.time() * 1000)
local data = {
user = 1,
created_at = now
}
local db, err = mongo:new(XXXXX)
local user = db:get_col("user")
local res, err = user:insert({data}, nil, true)
Data stored in created_at is actually {"v"=>1469128796000} and the value 1469128796000 is stored as int64 type, not mongo's Date type.
Does anybody has same issue or a suggestion to fix it?
Thanks