bigplum / lua-resty-mongol

A ngx_lua driver for mongodb -- Deprecated for not updating with the mongodb version
198 stars 67 forks source link

How to update using $set #31

Closed didasy closed 10 years ago

didasy commented 10 years ago

I have tried to do this

local n, err = sessions:update({ username = username }, { $set = { sessionid = base32 } }, 1, 0, 1)

But it returned this unexpected symbol near '$'

So how do I do this correctly?

didasy commented 10 years ago

Ok, I can do this:

local test = {}
test['$set'] = { sessionid = base32 }
local n, err = sessions:update({ username = username }, test, 1, 0, 1)

I hope there is a full documentation soon...