@chainsyncer/mongodb-adapter
v0.1.9
Published
MongoDB adapter for @chainsyncer
Downloads
29
Readme
MongoDB Adapter
MongoDB adapter for chain-syncer.
Install
$ npm i @chainsyncer/mongodb-adapter
Example usage (Mongoose)
const Mongoose = require('mongoose');
const { MongoDBAdapter } = require('@chainsyncer/mongodb-adapter');
const { ChainSyncer } = require('chain-syncer');
await Mongoose.connect('mongodb+srv://server.example.com/test');
const mongo_adapter = new MongoDBAdapter(Mongoose.connection.db);
const syncer = new ChainSyncer(mongo_adapter, ...);
Example usage (MongoDB NodeJS Driver)
const { MongoClient } = require('mongodb');
const { MongoDBAdapter } = require('@chainsyncer/mongodb-adapter');
const { ChainSyncer } = require('chain-syncer');
const connection = await MongoClient.connect( 'mongodb+srv://server.example.com/test' );
const db = await connection.db( 'test' );
const mongo_adapter = new MongoDBAdapter(db);
const syncer = new ChainSyncer(mongo_adapter, ...);
License
MongoDB adapter is released under the MIT license. © 2022 Polikarpov Nikita