MCPcopy
hub / github.com/electerm/electerm / update

Function update

src/client/common/db.js:91–106  ·  view source on GitHub ↗
(_id, value, db = 'data', upsert = true)

Source from the content-addressed store, hash-verified

89 * @param {string} db default is 'data'
90 */
91export function update (_id, value, db = 'data', upsert = true) {
92 const updates = dbNames.includes(db)
93 ? {
94 $set: value
95 }
96 : {
97 $set: {
98 value
99 }
100 }
101 return dbAction(db, 'update', {
102 _id
103 }, safeParse(updates), {
104 upsert
105 })
106}
107
108/**
109 * get doc from db

Callers 2

watch.jsFile · 0.90
sync.jsFile · 0.90

Calls 1

dbActionFunction · 0.70

Tested by

no test coverage detected