The background is that, the Lua's table type symbolize array and table both. So if I want to initialize a key in a document with {}, the value inserted is a table{} rather than a array []!! That brings many problems, for example:
local ret, err = exam_group_db:update({_id = _old_group_id}, {['$pushAll'] = {users = v_param.examinee_ids}})
if key users in the document is {}, the operation above will not work!!! Only if users 's value is [], the operation can work.
So how should I solve this problem? Thanks!
The background is that, the Lua's table type symbolize array and table both. So if I want to initialize a key in a document with
{}
, the value inserted is a table{}
rather than a array[]
!! That brings many problems, for example:local ret, err = exam_group_db:update({_id = _old_group_id}, {['$pushAll'] = {users = v_param.examinee_ids}})
if keyusers
in the document is{}
, the operation above will not work!!! Only ifusers
's value is[]
, the operation can work. So how should I solve this problem? Thanks!