Skip to content

Commit

Permalink
improve connection query performance migration 33
Browse files Browse the repository at this point in the history
  • Loading branch information
daneryl committed Feb 23, 2021
1 parent 20aa952 commit 021042c
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,15 +119,15 @@ async function existsRangesToConvert(db, file) {
return true;
}

const connections = await db
.collection('connections')
.find({ file: file._id.toString() })
.toArray();
const connections = (
await db
.collection('connections')
.find({ entity: file.entity, range: { $exists: true } })
.toArray()
).filter(c => c.file === file._id.toString());

for (let i = 0; i < connections.length; i += 1) {
if (connections[i].range) {
return true;
}
if (connections.length) {
return true;
}

return false;
Expand Down

0 comments on commit 021042c

Please sign in to comment.