I am making a FFlag system for my game, I am using MongoDB for it. I wanna check if a certain value in this collection is true or false. Here is my code:
if FFlagsData:FindOne({["allowRebirthing"] = true }) then
print("Test1")
else if FFlagsData:FindOne({["allowRebirthing"] = false }) then
print("Test2")
end
end
2
Answers
Try the following snippet of code:
Hope it works.
In Lua, the colon
:
is typically used for method calls, not for specifying object properties directly. Instead, you should use the equality operator=
to specify the property and its value in a Lua table.So, in Lua, your query object should be written like this:
{ allowRebirthing = true }
Plus, removed the square brackets around the field names. MongoDB queries do not need square brackets around field names.
({ allowRebirthing = true })
({ allowRebirthing = false })