{"id":46271,"library":"rivet-plugin-mongodb","title":"Rivet MongoDB Plugin","description":"A plugin for Rivet (AI graph application) providing 4 nodes to interact with MongoDB: store vectors, perform aggregations, search collections, and execute vector searches ($vectorSearch). Current stable version is 6.4.0, released as part of Rivet's plugin ecosystem. It is a community-maintained plugin that bridges Rivet's graph-based AI workflows with MongoDB's document and vector search capabilities. Key differentiators: native integration with Rivet nodes, support for MongoDB Atlas Vector Search, and simple plugin installation via Rivet's UI. Requires a MongoDB connection string and, for vector search, an appropriate Atlas index. Release cadence is irregular, with last major change being deprecation of MongoDBVectorKNN in favor of MongoDBVectorSearch.","status":"active","version":"6.4.0","language":"javascript","source_language":"en","source_url":"git://github.com/a-rothwell/rivet-plugin-mongodb","tags":["javascript"],"install":[{"cmd":"npm install rivet-plugin-mongodb","lang":"bash","label":"npm"},{"cmd":"yarn add rivet-plugin-mongodb","lang":"bash","label":"yarn"},{"cmd":"pnpm add rivet-plugin-mongodb","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Named import, not default import.","wrong":"import MongoDBStore from '@rivet-gg/plugin-mongodb'","symbol":"MongoDBStore","correct":"import { MongoDBStore } from '@rivet-gg/plugin-mongodb'"},{"note":"ESM-only package; CommonJS require not supported.","wrong":"const MongoDBAggregation = require('@rivet-gg/plugin-mongodb').MongoDBAggregation","symbol":"MongoDBAggregation","correct":"import { MongoDBAggregation } from '@rivet-gg/plugin-mongodb'"},{"note":"Named import.","wrong":"","symbol":"MongoDBCollectionSearch","correct":"import { MongoDBCollectionSearch } from '@rivet-gg/plugin-mongodb'"},{"note":"MongoDBVectorKNN was deprecated in v0.0.3; use MongoDBVectorSearch instead.","wrong":"import { MongoDBVectorKNN } from '@rivet-gg/plugin-mongodb'","symbol":"MongoDBVectorSearch","correct":"import { MongoDBVectorSearch } from '@rivet-gg/plugin-mongodb'"}],"quickstart":{"code":"import { MongoDBVectorSearch, MongoDBStore } from '@rivet-gg/plugin-mongodb';\n\n// Plugin nodes are used within Rivet graphs, not standalone.\n// Example configuration for MongoDBVectorSearch node:\nconst vectorSearchNode = new MongoDBVectorSearch({\n  collection: 'documents',\n  vectorField: 'embedding',\n  queryVector: [0.1, 0.2, 0.3],\n  numCandidates: 100,\n  limit: 10,\n  index: 'vector_index',\n  filter: { category: 'science' },\n  connectionString: process.env.MONGODB_URI ?? ''\n});\n\n// Example for MongoDBStore node to store a vector:\nconst storeNode = new MongoDBStore({\n  collection: 'documents',\n  vector: [0.1, 0.2, 0.3],\n  metadata: { title: 'Example', category: 'science' },\n  connectionString: process.env.MONGODB_URI ?? ''\n});","lang":"typescript","description":"Demonstrates how to import and configure the MongoDBVectorSearch and MongoDBStore nodes for use within Rivet graphs."},"warnings":[{"fix":"Remove MongoDBVectorKNN node and use MongoDBVectorSearch instead. Create a new Atlas Vector Search index per documentation.","message":"MongoDBVectorKNN node removed and replaced with MongoDBVectorSearch in version 0.0.3. Existing graphs using MongoDBVectorKNN will break.","severity":"breaking","affected_versions":">=0.0.3"},{"fix":"Create an index using MongoDB Atlas UI or CLI as described in https://www.mongodb.com/docs/atlas/atlas-vector-search/vector-search-type/","message":"MongoDBVectorSearch requires a pre-created Atlas Vector Search index on the collection. Without it, the node will fail.","severity":"gotcha","affected_versions":">=0.0.3"},{"fix":"Limit collection size or use MongoDBVectorSearch with filter for large datasets. The plugin roadmap notes this issue.","message":"MongoDBCollectionSearch node loads entire collection into memory; may cause performance issues for large collections.","severity":"gotcha","affected_versions":"*"},{"fix":"Replace MongoDBVectorKNN with MongoDBVectorSearch and update index.","message":"MongoDBVectorKNN is deprecated; new projects should use MongoDBVectorSearch.","severity":"deprecated","affected_versions":">=0.0.3"},{"fix":"Ensure MONGODB_URI environment variable is set or connection string is configured in Rivet plugin settings.","message":"Plugin requires a MongoDB connection string set in Rivet settings or passed via environment variable. Missing connection string causes runtime errors.","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"search_vec":"'4':12 '6.4.0':33 'aggreg':21 'ai':8,56 'applic':10 'appropri':97 'atlas':76,98 'base':55 'bridg':50 'cadenc':101 'capabl':65 'chang':107 'collect':23 'communiti':46 'community-maintain':45 'connect':90 'current':29 'deprec':109 'differenti':67 'document':61 'ecosystem':41 'execut':25 'favor':113 'graph':9,54 'graph-bas':53 'index':99 'instal':82 'integr':69 'interact':15 'irregular':103 'javascript':116 'key':66 'last':105 'maintain':47 'major':106 'mongodb':2,17,59,75,89 'mongodbvectorknn':111 'mongodbvectorsearch':115 'nativ':68 'node':13,72 'part':36 'perform':20 'plugin':3,5,40,48,81 'provid':11 'releas':34,100 'requir':87 'rivet':1,7,38,51,71,84 'search':22,27,64,78,95 'simpl':80 'stabl':30 'store':18 'string':91 'support':73 'ui':86 'vector':19,26,63,77,94 'vectorsearch':28 'version':31 'via':83 'workflow':57","created_at":"2026-06-07T12:59:07.227533+00:00","updated_at":"2026-06-07T12:59:07.227533+00:00","problems":[{"fix":"Replace MongoDBVectorKNN with MongoDBVectorSearch.","cause":"Using deprecated MongoDBVectorKNN node in version >=0.0.3.","error":"MongoDBVectorKNN is not a constructor"},{"fix":"Create a valid vector search index on the collection. See https://www.mongodb.com/docs/atlas/atlas-vector-search/vector-search-type/","cause":"Missing or incorrect Atlas Vector Search index on the collection.","error":"MongoError: bad index specification for $vectorSearch"},{"fix":"Check that the MONGODB_URI is correctly set and includes proper credentials.","cause":"Invalid MongoDB connection string or credentials.","error":"MongoError: Authentication failed"},{"fix":"Install plugin via Rivet UI plugins tab or add @rivet-gg/plugin-mongodb to package.json if using custom setup.","cause":"Plugin not installed in Rivet or incorrect import path.","error":"Cannot find module '@rivet-gg/plugin-mongodb'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"git://github.com/a-rothwell/rivet-plugin-mongodb","github":"git://github.com/a-rothwell/rivet-plugin-mongodb","docs":null,"changelog":null,"pypi":null,"npm":"rivet-plugin-mongodb","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database","ai-ml"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}