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

Function resolveIndexDescription

src/operations/indexes.ts:204–215  ·  view source on GitHub ↗

* Receives an index description and returns a modified index description which has had invalid options removed * from the description and has mapped the `version` option to the `v` option.

(
  description: IndexDescription
)

Source from the content-addressed store, hash-verified

202 * from the description and has mapped the `version` option to the `v` option.
203 */
204function resolveIndexDescription(
205 description: IndexDescription
206): Omit<ResolvedIndexDescription, 'key'> {
207 const validProvidedOptions = Object.entries(description).filter(([optionName]) =>
208 VALID_INDEX_OPTIONS.has(optionName)
209 );
210
211 return Object.fromEntries(
212 // we support the `version` option, but the `createIndexes` command expects it to be the `v`
213 validProvidedOptions.map(([name, value]) => (name === 'version' ? ['v', value] : [name, value]))
214 );
215}
216
217/**
218 * @public

Callers 1

constructorMethod · 0.85

Calls 3

filterMethod · 0.45
hasMethod · 0.45
mapMethod · 0.45

Tested by

no test coverage detected