ngx.req.read_body()
local json = ngx.req.get_body_data()
local a = {}
local b = {}
b[1] = json
a[1] = b
local mongol = require "resty.mongol"
conn = mongol:new()
conn:set_timeout(1000)
ok,err = conn:connect("127.0.0.1")
if not ok then
ngx.say(err)
end
local db = conn:new_db_handle("MongoDB")
col = db:get_col("Mongo_Collection")
n, err = col:insert(a, 1, 0)
if not n then
ngx.say(err)
end
--
You received this message because you are subscribed to a topic in the Google Groups "openresty-en" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/openresty-en/8mF9Jj8cSU8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to openresty-en...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.