lua - Parse rest api query with OR condition -
i having difficulties working out how perform or type query using parse rest api.
i have 2 classes set below. there 1 - many relationship between , b
classa -> objectid -> player1 -> player2 classb -> objectid -> classaid (pointer) -> somedata1 -> somedata2
what trying classb records current user id either in player1 or player2 field if classa.
i can query working when looking see if player1 field current user i.e. lua table looks (then encoded json , sent parse). send query classb rest url.
local querytable = { ["where"] = { ["classaid"] = { ["$inquery"] = {["where"] = { ["player1"] = settings.userid} , ["classname"] = "classa" } } } }
could point how can include player2 field.
if sql i'd on sonic parse different beast!
check out documentation on compound queries:
https://parse.com/docs/rest#queries-compound
as shown pattern "where={"$or":[{..expression1..},{..expression2..}]}".
so existing expression in place of "..expression1..", , use copy of player2
in place of "..expression2..".
Comments
Post a Comment