Closed mliker closed 7 years ago
Sadly, openresty's ngx.say doesn't automatically call __tostring metamethod on userdata, as opposed to lua's print. So you'll need to explicitly call tostring yourself, e.g.:
local doc, err = users:find_one({ email = "user@domain.com" })
for k,v in pairs(doc) do
ngx.say(tostring(k), tostring(v))
end
Excellent! Thank you for your answer.
I looked at you lua-cbson project, but still can't figure it out.
results in:
bad argument #2 to 'say' (string, number, boolean, nil, ngx.null, or array table expected, but got userdata)