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

Function findById

src/data-access/comments-db.js:23–32  ·  view source on GitHub ↗
({ id: _id })

Source from the content-addressed store, hash-verified

21 }))
22 }
23 async function findById ({ id: _id }) {
24 const db = await makeDb()
25 const result = await db.collection('comments').find({ _id })
26 const found = await result.toArray()
27 if (found.length === 0) {
28 return null
29 }
30 const { _id: id, ...info } = found[0]
31 return { id, ...info }
32 }
33 async function findByPostId ({ postId, omitReplies = true }) {
34 const db = await makeDb()
35 const query = { postId: postId }

Callers

nothing calls this directly

Calls 1

makeDbFunction · 0.70

Tested by

no test coverage detected