@casual-simulation/causal-tree-store-mongodb

A causal tree store that interfaces with MongoDB

Usage no npm install needed!

<script type="module">
  import casualSimulationCausalTreeStoreMongodb from 'https://cdn.skypack.dev/@casual-simulation/causal-tree-store-mongodb';
</script>

README

Causal Tree Store MongoDB

npm (scoped)

A causal repo store that interfaces with MongoDB.

Usage

Create a MongoDB Causal Repo Store

import { MongoDBRepoStore } from '@casual-simulation/causal-tree-store-mongodb';
import { MongoClient } from 'mongodb';

MongoClient.connect('mongodb://127.0.0.1:27017', client => {
    const db = client.db('my_db');
    const objects = db.collection('objects');
    const heads = db.collection('heads');
    const store = new MongoDBRepoStore(objects, heads);

    store.init().then(() => {
        // TODO: Store or create objects and heads
    });
});