admin管理员组文章数量:1336415
I have a database like this (photo attached):
Trip has BIDS
, and awardedBid
. I use awardedBid!=null
as a way to determine the trip is still available for bidding. However, I don't know how to query for that condition, so I have to hack by creating another field bidDone
so I can use .equalTo
, like this
mRootReference.child(CHILD_TRIPS).child(mTripKey).orderByChild(BID_DONE).equalTo(true)
However I feel that's unsafe when I have to use 2 keys to denote just one thing since it's bug-prone (I did create one myself in the attached screenshot where bidDone = false
where it should be true
).
Is there any cleaner way for that task: query with condition that a string exist?
Thanks
I have a database like this (photo attached):
Trip has BIDS
, and awardedBid
. I use awardedBid!=null
as a way to determine the trip is still available for bidding. However, I don't know how to query for that condition, so I have to hack by creating another field bidDone
so I can use .equalTo
, like this
mRootReference.child(CHILD_TRIPS).child(mTripKey).orderByChild(BID_DONE).equalTo(true)
However I feel that's unsafe when I have to use 2 keys to denote just one thing since it's bug-prone (I did create one myself in the attached screenshot where bidDone = false
where it should be true
).
Is there any cleaner way for that task: query with condition that a string exist?
Thanks
Share Improve this question edited Jul 19, 2016 at 19:01 Frank van Puffelen 599k85 gold badges888 silver badges858 bronze badges asked Jul 18, 2016 at 15:39 EyeQ TechEyeQ Tech 7,35819 gold badges75 silver badges129 bronze badges1 Answer
Reset to default 24You can remove your attribute bidDone
and using startAt()
to get all the child having awardedBid
not null:
ref.orderByChild("awardedBid").startAt("")
or this to get only the child without bid
ref.orderByChild("awardedBid").endAt(null)
本文标签: javascriptFirebasequery with quota child existsquot as a conditionStack Overflow
版权声明:本文标题:javascript - Firebase, query with "a child exists" as a condition? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1739213656a2149184.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论