[Mastra] Document MongoDB differentiators

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Unresolved
    • Priority: Unknown
    • None
    • Affects Version/s: None
    • Component/s: ABX
    • None
    • None
    • None
    • None
    • None
    • None

      Update Mastra's official documentation to reflect the currently implemented but undocumented MongoDB strong differentiators:

       

      Area Gap
      Pre-filter (filterFields) Only a reference param; invisible in concept docs
      VoyageAI reranker VoyageRelevanceScorer/createVoyageReranker ship in code but no doc references them (only Cohere shown)
      BYO positioning Mechanics documented, but "no copy / no sync" value prop unstated (0 hits); absent from RAG overview; no pgvector comparison
      Examples → RAG No MongoDB example (hybrid / BYO / pre-filter)

      Features to document:

      1. Voyage Rerankers

      What it is:
      @mastra/voyageai exports a RelevanceScoreProvider ( VoyageRelevanceScorer / createVoyageReranker ) that plugs into Mastra's rerankWithScorer() and createVectorQueryTool() — but the reranking docs only show CohereRelevanceScorer . Note the Voyage scorer takes a config object (

      { model }

      ), unlike Cohere's string arg.

      a) With rerankWithScorer():

      import { rerankWithScorer as rerank } from '@mastra/rag'
      import { VoyageRelevanceScorer } from '@mastra/voyageai'
      
      const scorer = new VoyageRelevanceScorer({ model: 'rerank-2.5' }) // reads VOYAGE_API_KEY
      
      const results = await store.query({ indexName: 'docs', queryVector: embedding, topK: 20 })
      
      const reranked = await rerank({
        results,
        query: 'How do I deploy to production?',
        scorer,
        options: { topK: 5 },
      })
      

      b) With the Vector Query Tool:
       

      import { createVectorQueryTool } from '@mastra/rag'
      import { createVoyageReranker } from '@mastra/voyageai'
      
      const tool = createVectorQueryTool({
        vectorStore: store,
        indexName: 'docs',
        model: embedder,
        reranker: { model: createVoyageReranker('rerank-2.5'), options: { topK: 5 } },
      })
      

      2. Vector Search Pre-filters

      Example:

      // 1. Declare filter fields when creating the index
      await store.createIndex({
        indexName: 'docs',
        dimension: 1024,
        metric: 'cosine',
        filterFields: ['category', 'tenantId'], // registered as metadata.<field> in the vectorSearch index
      })
      
      // 2. Query as usual — filters on declared fields are pushed into $vectorSearch natively
      const results = await store.query({
        indexName: 'docs',
        queryVector: embedding,
        topK: 10,
        filter: { category: 'finance', tenantId: 'acme' },
      })
      
      // A filter on an UNDECLARED field (or an operator $vectorSearch can't push down)
      // automatically falls back to the pre-filter path — no error, just slower.
      
      
      

            Assignee:
            Unassigned
            Reporter:
            Raschid Jimenez
            None
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: