Skip to main content
Version: V1.2.0

get - Retrieve

The get() method is used to retrieve documents from a collection without performing vector similarity search.

It supports filtering by IDs, metadata, and document.

info

This API can only be used when connected with SeekdbClient. For more information about SeekdbClient, see SeekdbClient.

Prerequisites​

  • You have installed seekdb-js. For more information, see Quick start.

  • If you use seekdb in server mode, make sure seekdb server mode is installed. For more information, see Deploy seekdb with package managers.

  • You have connected to the database. For more information, see SeekdbClient.

  • You have created a collection and inserted data. For more information, see createCollection and add.

Request parameters​

get()
ParameterTypeRequiredDescriptionExample Value
idsstring | string[]YesThe ID or list of IDs to retrieve.['1', '2']
whereWhereNoMetadata filter conditions.{ category: 'science' }
whereDocumentWhereDocumentNoDocument filter conditions.{"$contains": "machine"}
limitnumberNoThe maximum number of results to return.{"category": {"$eq": "AI"}}
offsetnumberNoThe number of results to skip for pagination.{"$contains": "machine"}
includereadonly ("documents" | "metadatas" | "embeddings")[]NoThe list of fields to include: ["documents", "metadatas", "embeddings"].["documents", "metadatas", "embeddings"]
info

If no parameters are provided, all data is returned.

Request example​

import { SeekdbClient } from "seekdb";

// Embedded mode - Database management (seekdb Embedded)
// const client = new SeekdbClient({
// path: "./seekdb.db",
// database: "test",
// });

// Remote server mode - Database management (seekdb Server)
const client = new SeekdbClient({
host: "127.0.0.1",
port: 2881,
user: "root",
password: "",
database: "test",
});

const collection = await client.getCollection({name: 'my_collection'});

const result = await collection.get({
ids: ['1', '2']
});

Response parameters​

  • If a single ID is provided: the response includes the get object for that ID.
  • If multiple IDs are provided: a list of QueryResult objects, one for each ID.
  • If filters are provided: a QueryResult object containing all matching results.