techfort / LokiJS

javascript embeddable / in-memory database
http:/techfort.github.io/LokiJS
MIT License
6.76k stars 482 forks source link

Find overrides the rezultset #894

Closed mostfurious closed 2 years ago

mostfurious commented 3 years ago

Hello, Dont know if im doing something wrong because i cant find any info on this but when i use find on a resultset in overrides all data in the array. First i join two databases like so: let resultz = classes.eqJoin(techers,"mok_id","$loki",mapfun).eqJoin(things, "dalyk_id", "$loki", map2) That works fine and does what i want. Then i want to use find on 'resultz' like so: let classz = resultz.find({'$and':[{'mok_id' : {'$eq': techer.$loki}}, {'dalyk_id': {'$eq': techer.dest_dalyk[id${j+1}]}}]}) That runs trough a loop and i want to use 'rezultz' multiple times. It works on the first iteration, but on the second it returns empty array. So i checked the rezutz which is outside the loop and once i use find the resultset gets overwritten with what 'find' found. How do i use resultz multiple times ? Make new resultz and map it on every loop ? Isnt there any other way ?

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.