Replace Bad Instance of databaseTiny.find()#474
Merged
thehabes merged 2 commits intodevelopmentfrom Mar 12, 2026
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #471
Summary
databaseTiny.find({_id})inupdateLayerAndProject()— replaced withfetch(page.id)pattern matchingPage.js:183-205. The old call had two compounding bugs:find({_id})fails collection resolution —determineDataType()cannot identify a type from{_id}alone, soresolveCollection()returnsnulland the driver throws.find()returns an array — even if resolution worked, the code treated the result as a single document, setting.partOfon an array./my/profilerequests.Changes
utilities/shared.js:87-112databaseTiny.find()withfetch(page.id)+ error handling + response body validation__tests__/smoke.test.js:60-63Why
fetch(page.id)instead of fixing thefind()callThe page IDs in this code path are already full RERUM URLs (filtered by
.startsWith(process.env.RERUMIDPREFIX)on line 85). Fetching by URL is the established pattern throughout the codebase (Page.js:183,Page.js:82) and avoids both the collection resolution issue and the array-vs-document issue entirely. No new dependencies —fetchis native in Node 18+.