Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-82866

Some vector values are getting rounded to the nearest int, causing a BSON type error at $vectorSearch query time

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Server Triage

      What problem are you facing?

      Floating point numbers within vector embedding being converted to integers, causing BSON type issue at query time when executing $vectorSearch.

      $vectorSearch:MongoServerError: BSON field '$vectorSearch.queryVector.117' is the wrong type 'int', expected type 'double'

      {{}}

      Manually replacing each instance of -1, 0, or 1 with a floating point number of similar value resolves the problem, which suggests that there is some implicit type conversion happening on the node side.

      What driver and relevant dependency versions are you using?

       

      {{}}

      node --version
      v20.5.1cat package.json 
      {
      "dependencies": {
      "dotenv": "^16.1.3",
      "mongodb": "^5.7.0",
      "graphviz": "^0.0.9",
      "canvas": "^2.11.2",
      "@aws-sdk/client-bedrock-runtime": "^3.433.0"
      }
      }MongoDB 7.0.2 (on Atlas M10)AWS Bedrock Embeddings Model:  amazon.titan-embed-text-v1

      Steps to reproduce?

      Execute $vectorSearch on embeddings produced from the linked embedding model.

            Assignee:
            henry.weller@mongodb.com Henry Weller
            Reporter:
            henry.weller@mongodb.com Henry Weller
            Votes:
            1 Vote for this issue
            Watchers:
            16 Start watching this issue

              Created:
              Updated: