MCPcopy
hub / github.com/mongodb/node-mongodb-native / normalizeHintField

Function normalizeHintField

src/utils.ts:103–122  ·  view source on GitHub ↗
(hint?: Hint)

Source from the content-addressed store, hash-verified

101 * @internal
102 */
103export function normalizeHintField(hint?: Hint): Hint | undefined {
104 let finalHint = undefined;
105
106 if (typeof hint === 'string') {
107 finalHint = hint;
108 } else if (Array.isArray(hint)) {
109 finalHint = {};
110
111 hint.forEach(param => {
112 finalHint[param] = 1;
113 });
114 } else if (hint != null && typeof hint === 'object') {
115 finalHint = {} as Document;
116 for (const name in hint) {
117 finalHint[name] = hint[name];
118 }
119 }
120
121 return finalHint;
122}
123
124const TO_STRING = (object: unknown) => Object.prototype.toString.call(object);
125/**

Callers 2

hintMethod · 0.90
makeFindCommandFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected