Vector DBs & RAG (50 Qs)•Part 1: Basic & Foundational Concepts (Junior / Entry-Level)
How do you perform basic vector upsert and query in Pinecone or Qdrant?
junior LevelMost AskedCode ExampleForms
In Simple Words: Vector databases use unique IDs, floating-point vector arrays, and JSON metadata payloads:
typescript
// Qdrant JS SDK Example:
import { QdrantClient } from "@qdrant/js-client-rest";
const client = new QdrantClient({ url: "http://localhost:6333" });
// Upsert vectors with metadata:
await client.upsert("articles", {
points: [
{
id: "doc_1",
vector: [0.05, 0.81, -0.23, 0.44], // 4D sample vector
payload: { title: "Next.js App Router Guide", author: "Jane Doe", year: 2026 }
}
]
});
// Search nearest neighbors:
const searchResults = await client.search("articles", {
vector: [0.04, 0.79, -0.21, 0.41],
limit: 5,
filter: {
must: [{ key: "year", match: { value: 2026 } }]
}
});