I need to do a find in a mongodb, but utility de $or. I read in the documentation that is it possible but I have problem.
I am utility this command.
coronium:getObjects (“db”, {where = {$or: [{usuario=“nombre1”, usuario = “nombre2”}}, onGetObject)
Any idea. thank you
Does this get your results?
[lua]coronium:getObjects( “db”, { where = { ["$or"] = { {usuario=“nombre1”}, {usuario=“nombre2”} } } }, onGetObject )[/lua]
Let me know.
Thank you, but when I get the result with this sentence, only have one result and not is it correct
table: 0x7f835421e160 1
may 18 01:10:11.216 1 table: 0x7f8351cce8d0 nil
may 18 01:10:11.216 nil
In this query I should to have 3 results, and where is it nil should to write the name
What is the code used to loop through the results?
Thanks
I use this fuction to tthe result
local function onGetObject (event)
print (event.error)
print (event.result, #event.result)
for i,v in ipairs (event.result) do
print (event.result[1].usuario)
end
end
Thank you.
Does this get your results?
[lua]coronium:getObjects( “db”, { where = { ["$or"] = { {usuario=“nombre1”}, {usuario=“nombre2”} } } }, onGetObject )[/lua]
Let me know.
Thank you, but when I get the result with this sentence, only have one result and not is it correct
table: 0x7f835421e160 1
may 18 01:10:11.216 1 table: 0x7f8351cce8d0 nil
may 18 01:10:11.216 nil
In this query I should to have 3 results, and where is it nil should to write the name
What is the code used to loop through the results?
Thanks
I use this fuction to tthe result
local function onGetObject (event)
print (event.error)
print (event.result, #event.result)
for i,v in ipairs (event.result) do
print (event.result[1].usuario)
end
end
Thank you.