[V3 Mongo] Correct dictionary rebuilding process for global all case (#2581)

This commit is contained in:
Will 2019-04-13 15:51:49 -04:00 committed by GitHub
parent 8b3c3e89e9
commit 0652dd344b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -87,10 +87,10 @@ class Mongo(BaseDriver):
async for doc in cursor:
pkeys = doc["_id"]["RED_primary_key"]
del doc["_id"]
if len(pkeys) == 1:
if len(pkeys) == 0:
# Global data
ret.update(**doc)
elif len(pkeys) > 1:
elif len(pkeys) > 0:
# All other data
partial = ret
for key in pkeys[:-1]:
@ -103,8 +103,6 @@ class Mongo(BaseDriver):
partial.update(**doc)
else:
partial[pkeys[-1]] = doc
else:
raise RuntimeError("This should not happen.")
return ret
async def get(self, identifier_data: IdentifierData):