N
N
novicheck2016-08-15 15:58:39
Python
novicheck, 2016-08-15 15:58:39

How to find lost records?

I have to match records by 2 characteristics. The first is the date of the event and the second is the start date. I take from the database like this

heh = list(db.events.aggregate(
[
  {"$match": {"eventName" : "Purchase Hard"}},
  {"$group": {"_id": "$uid", "dateofpay": {"$addToSet": "$updated_at"}}},
]))

lel = list(db.events.aggregate(
[
  {"$match": {"eventName" : "Level 1"}},
  {"$group": {"_id": "$uid", "dateofstart": {"$addToSet": "$updated_at"}}}
]))

in theory, the first query gives about 1600 records, after this comparison, they remain about 850:
dateoflvl1pay = list()
for players in lel:
  kost = players["_id"]
  if kost in x:
     dateoflvl1pay.append(players)

moreover, such a query produces the same 1600 records, that is, all 1600 must have both "Level 1" and "Purchase Hard"
= list(db.events.distinct("uid", {"eventName": "Level 1"}) and db.events.distinct("uid", {"eventName": "Purchase Hard"}))
please tell me how to solve this problem.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question