1.0.15 • Published 3 months ago

@storecraft/database-mongodb v1.0.15

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

Storecraft MongoDB driver for Node.js

MongoDB

Official mongodb driver for StoreCraft on Node.js / Deno / Bun platforms. Also, official support for mongo-db as vector store.

npm i @storecraft/database-mongodb

usage

import 'dotenv/config';
import http from "node:http";
import { App } from '@storecraft/core'
import { NodePlatform } from '@storecraft/core/platform/node';
import { MongoDB } from '@storecraft/database-mongodb'
import { migrateToLatest } from '@storecraft/database-mongodb/migrate.js'
import { NodeLocalStorage } from '@storecraft/core/storage/node'
import { MongoVectorStore } from '@storecraft/database-mongodb/vector-store'

const app = new App()
.withPlatform(new NodePlatform())
.withDatabase(new MongoDB({}))
.withVectorStore(
  new MongoVectorStore({ embedder: new OpenAIEmbedder() })
)

await app.init();
await migrateToLatest(app.db, false);
// cerate if not exists
await app.vectorstore.createVectorIndex(false, false);

const server = http.createServer(app.handler).listen(
  8000,
  () => {
    console.log(`Server is running on http://localhost:8000`);
  }
); 
Author: Tomer Shalev <tomer.shalev@gmail.com>
1.0.15

3 months ago

1.0.14

3 months ago

1.0.9

5 months ago

1.0.8

5 months ago

1.0.7

5 months ago

1.0.6

7 months ago

1.0.11

4 months ago

1.0.10

5 months ago

1.0.13

4 months ago

1.0.12

4 months ago

1.0.5

8 months ago

1.0.4

8 months ago

1.0.3

8 months ago

1.0.2

8 months ago

1.0.1

10 months ago