From 545276318d8dd8a4fd890c09ffa525bd43f2a630 Mon Sep 17 00:00:00 2001 From: Gatefixer <313497061+lancedb-gatefixer[bot]@users.noreply.github.com> Date: Wed, 5 Aug 2026 19:52:12 +0000 Subject: [PATCH] docs(nodejs): explain opening existing LangChain tables --- nodejs/README.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/nodejs/README.md b/nodejs/README.md index 2ca1be7b0..6c368cba8 100644 --- a/nodejs/README.md +++ b/nodejs/README.md @@ -30,6 +30,27 @@ const results = await table.vectorSearch([0.1, 0.3]).limit(20).toArray(); console.log(results); ``` +### Use an Existing Table with LangChain + +When wrapping an existing table with `@langchain/community`, open the table +with LanceDB and pass the resulting table handle to LangChain. The LangChain +`uri` and `tableName` options are used when creating a table; they do not open +an existing table for search. + +```javascript +import { LanceDB as LangChainLanceDB } from "@langchain/community/vectorstores/lancedb"; +import * as lancedb from "@lancedb/lancedb"; + +const db = await lancedb.connect("data/sample-lancedb"); +const table = await db.openTable("my_table"); +const vectorStore = new LangChainLanceDB(embeddings, { table }); + +const results = await vectorStore.similaritySearchVectorWithScore( + queryVector, + 5, +); +``` + The [quickstart](https://docs.lancedb.com/quickstart/) contains more complete examples. ## Development