Skip to content

Add TypeScript interface for the new PipelineStage - Vector Search #14428

Closed
@jkorach

Description

@jkorach

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the feature has not already been requested

🚀 Feature Proposal

With MongoDB releasing the new vector search index & pipeline stage, Mongoose is missing this PiplineStage, which creates compilation error in TypeScript. The proposal is to add support for this new PipelineStage

Motivation

To maintain & support the typesafe aggregation pipeline in Mongoose.

Example

import mongoose from "mongoose";

const contentsSchema = new mongoose.Schema({
  embedding: {
    type: [Number],
  },
  title: String,
});
export const Contents = mongoose.model(
  "Contents",
  contentsSchema,
  "contents",
);

 const result = await Contents.aggregate([
    {
      $vectorSearch: {
        index: "title_vector_index",
        path: "embedding",
        filter: {someField: "value"}
        queryVector:[0.3455,......0.123],
        numCandidates: 200,
        limit: 10,
      },
    },
  ]);

Metadata

Metadata

Assignees

No one assigned

    Labels

    typescriptTypes or Types-test related issue / Pull Request

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions