Skip to content

[BUG] Mongo Vector TypeError: Cannot read properties of undefined (reading 'startsWith') at <unknown> #11697

Description

@crapthings

Describe the Bug

i'm trying to use mongo vector feature, but it doesn't work.

   "@mastra/ai-sdk": "^1.0.0-beta.12",
    "@mastra/core": "^1.0.0-beta.19",
    "@mastra/fastembed": "^1.0.0-beta.2",
    "@mastra/memory": "^1.0.0-beta.10",
    "@mastra/mongodb": "^1.0.0-beta.9",

Steps To Reproduce

import { MongoDBStore, MongoDBVector } from '@mastra/mongodb'

console.log('MONGO_URL_MASTRA:', process.env.MONGO_URL_MASTRA)
console.log('MONGO_DATABASE_MASTRA:', process.env.MONGO_DATABASE_MASTRA)
console.log(MongoDBVector)

export const storage = new MongoDBStore({
  id: 'mastra',
  url: process.env.MONGO_URL_MASTRA,
  dbName: process.env.MONGO_DATABASE_MASTRA
})

export const vectorStorage = new MongoDBVector({
  id: 'atlas',
  url: process.env.MONGO_URL_MASTRA,
  dbName: process.env.MONGO_DATABASE_MASTRA
})

await vectorStorage.createIndex({
  indexName: 'atlas_embeddings',
  dimension: 1536
})
MONGO_URL_MASTRA: mongodb://localhost:27017/?directConnection=true
MONGO_DATABASE_MASTRA: vortexis-studio
[class MongoDBVector extends MastraVector]
⨯ TypeError: Cannot read properties of undefined (reading 'startsWith')
    at <unknown> (src/mastra/storage.js:13:30)
  11 | })
  12 |
> 13 | export const vectorStorage = new MongoDBVector({
     |                              ^
  14 |   id: 'atlas',
  15 |   url: process.env.MONGO_URL_MASTRA,
  16 |   dbName: process.env.MONGO_DATABASE_MASTRA {

Link to Minimal Reproducible Example

https://github.com/mastra-ai/mastra

Expected Behavior

using mongo

Environment Information

"@mastra/ai-sdk": "^1.0.0-beta.12",
    "@mastra/core": "^1.0.0-beta.19",
    "@mastra/fastembed": "^1.0.0-beta.2",
    "@mastra/memory": "^1.0.0-beta.10",
    "@mastra/mongodb": "^1.0.0-beta.9",

Verification

  • I have searched the existing issues to make sure this is not a duplicate
  • I have included sufficient information for the team to reproduce and understand the issue

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    RAGIssues with Mastra's RAG systemStorageIssues with Mastra Storage adapters for databases and vector storagebugSomething isn't workingeffort:mediumimpact:hightrio-tnt

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions