-
Type:
Bug
-
Resolution: Gone away
-
Priority:
Unknown
-
None
-
Affects Version/s: 6.13.0, 6.16.0
-
Component/s: None
Problem:
I am trying to use `collection.createSearchIndex()` and `collection.updateSearchIndex()` to programmatically manage a vector search index.
Here's the shape of the index definition:
const index = { name: "test_vector_search_index", type: "vectorSearch", definition: { fields: [...], }, };
When I call `collection.createSearchIndex(index)` with this definition, it creates the index with no problems.
However, when I call `collection.updateSearchIndex(index.name, index.definition)`, it throws the following error:
MongoServerError: "userCommand.mappings" is required at Connection.sendCommand (.../npm_mongodb_6.13.0-6d6f49b5/files/src/cmap/connection.ts:548:17) at Connection.command (.../npm_mongodb_6.13.0-6d6f49b5/files/src/cmap/connection.ts:622:22) at Server.command (.../npm_mongodb_6.13.0-6d6f49b5/files/src/sdam/server.ts:335:21) at UpdateSearchIndexOperation.execute (.../npm_mongodb_6.13.0-6d6f49b5/files/src/operations/search_indexes/update.ts:34:5) at tryOperation (.../npm_mongodb_6.13.0-6d6f49b5/files/src/operations/execute_operation.ts:283:14) at executeOperation (.../npm_mongodb_6.13.0-6d6f49b5/files/src/operations/execute_operation.ts:115:12) at Collection.updateSearchIndex (.../npm_mongodb_6.13.0-6d6f49b5/files/src/collection.ts:1265:12) [local frames] { errorLabelSet: Set(0) {}, errorResponse: { ok: 0, errmsg: '"userCommand.mappings" is required', code: 8, codeName: 'UnknownError', '$clusterTime': { clusterTime: new Timestamp({ t: 1745871047, i: 39 }), signature: [Object] }, operationTime: new Timestamp({ t: 1745871047, i: 39 }) }, ok: 0, code: 8, codeName: 'UnknownError', '$clusterTime': { clusterTime: new Timestamp({ t: 1745871047, i: 39 }), signature: { hash: Binary.createFromBase64('AAAAAAAAAAAAAAAAAAAAAAAAAAA=', 0), keyId: 0 } }, operationTime: new Timestamp({ t: 1745871047, i: 39 }) }
However, the documentation for search indexes clearly states that `mappings` is only required for regular search indexes, not vector search indexes.
- https://www.mongodb.com/docs/atlas/atlas-search/searching/#define-your-index
- https://www.mongodb.com/docs/atlas/atlas-vector-search/vector-search-type/#syntax
I believe there is incorrect validation going on, either client side (in the Node.js driver) or server-side. Please correct me if I am wrong and show me the correct way to update a vector index.
Most of the template below is not applicable.
======
Use Case
As a... developer
I want... this bug fixed
So that... I can update search indexes programmatically
User Experience
- What is the desired/expected outcome for the user once this ticket is implemented?
- If bug: What is the number of impacted customers? How severe is the impact? Is anyone blocked or broken?
Dependencies
- upstream and/or downstream requirements and timelines to bear in mind
Risks/Unknowns
- What could go wrong while implementing this change? (e.g., performance, inadvertent behavioral changes in adjacent functionality, existing tech debt, etc)
- Is there an opportunity for better cross-driver alignment or testing in this area?
- Is there an opportunity to improve existing documentation on this subject?
Acceptance Criteria
Implementation Requirements
- functional reqs, potential snafus to avoid, performance targets, etc
Testing Requirements
- unit test, spec test sync, etc
Documentation Requirements
- DOCSP ticket, API docs, etc
Follow Up Requirements
- additional tickets to file, required releases, etc
- if node behavior differs/will differ from other drivers, confirm with dbx devs what standard to aim for and what plan, if any, exists to reconcile the diverging behavior moving forward
- related to
-
DRIVERS-3078 Include the type field in updateSearchIndex command document
-
- Backlog
-