MCPcopy Create free account
hub / github.com/hydro-dev/Hydro / get

Function get

packages/hydrooj/src/model/document.ts:92–98  ·  view source on GitHub ↗
(domainId: string, docType: K, docId: DocType[K]['docId'], projection?: Projection<DocType[K]>)

Source from the content-addressed store, hash-verified

90}
91
92export async function get<K extends keyof DocType>(domainId: string, docType: K, docId: DocType[K]['docId'], projection?: Projection<DocType[K]>) {
93 let cursor = coll.find({ domainId, docType, docId }).limit(1);
94 if (projection) cursor = cursor.project(buildProjection(projection));
95 const result = await cursor.toArray();
96 if (result.length) return result[0];
97 return null;
98}
99
100export async function set<K extends keyof DocType>(
101 domainId: string,

Callers

nothing calls this directly

Calls 2

buildProjectionFunction · 0.90
findMethod · 0.80

Tested by

no test coverage detected