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

Function insert

src/data-access/comments-db.js:56–63  ·  view source on GitHub ↗
({ id: _id = Id.makeId(), ...commentInfo })

Source from the content-addressed store, hash-verified

54 }))
55 }
56 async function insert ({ id: _id = Id.makeId(), ...commentInfo }) {
57 const db = await makeDb()
58 const result = await db
59 .collection('comments')
60 .insertOne({ _id, ...commentInfo })
61 const { _id: id, ...insertedInfo } = result.ops[0]
62 return { id, ...insertedInfo }
63 }
64
65 async function update ({ id: _id, ...commentInfo }) {
66 const db = await makeDb()

Callers

nothing calls this directly

Calls 1

makeDbFunction · 0.70

Tested by

no test coverage detected