0

I have two variables

user1 = eachData["user1"]
user2 = eachData["user2"]

i want to extract data from a collection of firestore when either of the following 2 condition is satisfied

condition 1: username = user1 and contactusername = user2
condition2: username = user2 and contactusername = user1

all the data which satisfies any one of the above two conditions has to be extracted. i know to extract for one condition

refid = *****.where(u'timestamp', u'<=', end_time).where(u'timestamp', u'>=', start_time).order_by(u'timestamp', u'DESCENDING') #to extract data from timerange

query = refid.where(u'username', u'==', user1).where(u'contactusername', u'==', user2)
#extracts for condtion1

basically result should be

result = condition1 or condition2

how can i do it for multiple condition?

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441
phoenix
  • 328
  • 2
  • 12

0 Answers0