MCPcopy Create free account
hub / github.com/monkeytypegame/monkeytype / updateUser

Function updateUser

backend/src/dal/user.ts:1238–1252  ·  view source on GitHub ↗

* Update user document. Requires the user to exist * @param filter user filter * @param update update document * @param error stack description used in the error or statusCode and message of the error * @throws MonkeyError if user does not exist

(
  filter: Filter<DBUser>,
  update: UpdateFilter<DBUser>,
  error: { stack: string; statusCode?: number; message?: string },
)

Source from the content-addressed store, hash-verified

1236 * @throws MonkeyError if user does not exist
1237 */
1238async function updateUser(
1239 filter: Filter<DBUser>,
1240 update: UpdateFilter<DBUser>,
1241 error: { stack: string; statusCode?: number; message?: string },
1242): Promise<void> {
1243 const result = await getUsersCollection().updateOne(filter, update);
1244
1245 if (result.matchedCount !== 1) {
1246 throw new MonkeyError(
1247 error.statusCode ?? 404,
1248 error.message ?? "User not found",
1249 error.stack,
1250 );
1251 }
1252}
1253
1254export async function getFriends(uid: string): Promise<DBFriend[]> {
1255 return await aggregateWithAcceptedConnections(

Callers 15

updateQuoteRatingsFunction · 0.70
updateEmailFunction · 0.70
addResultFilterPresetFunction · 0.70
removeResultFilterPresetFunction · 0.70
addTagFunction · 0.70
editTagFunction · 0.70
removeTagFunction · 0.70
removeTagPbFunction · 0.70
updateLbMemoryFunction · 0.70
resetPbFunction · 0.70
linkDiscordFunction · 0.70
unlinkDiscordFunction · 0.70

Calls 1

getUsersCollectionFunction · 0.85

Tested by

no test coverage detected