MCPcopy Index your code
hub / github.com/dev-mastery/comments-api / findByHash

Function findByHash

src/data-access/comments-db.js:77–86  ·  view source on GitHub ↗
(comment)

Source from the content-addressed store, hash-verified

75 return result.deletedCount
76 }
77 async function findByHash (comment) {
78 const db = await makeDb()
79 const result = await db.collection('comments').find({ hash: comment.hash })
80 const found = await result.toArray()
81 if (found.length === 0) {
82 return null
83 }
84 const { _id: id, ...insertedInfo } = found[0]
85 return { id, ...insertedInfo }
86 }
87}

Callers

nothing calls this directly

Calls 1

makeDbFunction · 0.70

Tested by

no test coverage detected