4.1.0 • Published 2 years ago

bugfinder-commit-db-mongodb v4.1.0

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

Description

This package is used as a DB for different phases of the machine learning pipeline of the bugfinder-framework or (npm:bugfinder-framework). You can read and write Commits as Localities, LocalityMaps of Annotations and LocalityMaps of Quantifications with this package to a MongoDB.

Prerequisites

You need to begin with understanding the bugfinder-framework and installing it:

npm i bugfinder-framework

MongoDB installed. Used version:

4.4.1 2008R2Plus SSL (64 bit)

Optional You might also want to install MongoDB Compass

Usage

npm i -D bugfinder-commit-db-mongodb

This package is not intended to be used independently, but feel free to do so. It is used in its phases of the machine-learning-pipeline of the bugfinder-framework. Here an example using it in the phase of recording localities. inversify.config.ts

import path = require("path");
import {
    BUGFINDER_LOCALITYRECORDER_COMMIT_TYPES, Commit, CommitRecorder, GitOptions
} from "bugfinder-localityrecorder-commit";
import {DB, LOCALITY_A_TYPES, LocalityRecorder} from "bugfinder-framework";
import {MongoDBConfig} from "bugfinder-commit-db-mongodb";
import {BUGFINDER_DB_COMMITPATH_MONGODB_TYPES, CommitPathsMongoDB} from "bugfinder-commitpath-db-mongodb";
import {localityAContainer} from "bugfinder-framework-defaultcontainer";

const container = localityAContainer;
const projectRoot: string = path.join(process.cwd(), "../repositories/TypeScript")

const gitOptions: GitOptions = {
    baseDir: projectRoot,
    maxConcurrentProcesses: 4
}

const mongoDBConfig: MongoDBConfig = {
    url: "mongodb://localhost:27017",
    dbName: "TEST"
}

// binding localityRecorder and its dependencies
container.bind<LocalityRecorder<Commit>>(LOCALITY_A_TYPES.commitRecorder).to(CommitRecorder)
// bindings used in CommitRecorder
container.bind<GitOptions>(BUGFINDER_LOCALITYRECORDER_COMMIT_TYPES.gitOptions).toConstantValue(gitOptions)

// binding db and its dependencies
container.bind<DB<Commit, any, any>>(LOCALITY_A_TYPES.db).to(CommitMongoDB);
container.bind<MongoDBConfig>(BUGFINDER_DB_COMMITPATH_MONGODB_TYPES.mongoDBConfig).toConstantValue(mongoDBConfig);

export {container}

main.ts

import "reflect-metadata";
import {container} from "./inversify.config"
import {
    DB, LOCALITY_A_TYPES,
} from "bugfinder-framework";
import {Commit} from "bugfinder-localityrecorder-commit";

async function topLevelAwaitWrapper() {
    const localityRecorder = container.get<LocalityRecorder<Commit>>(LOCALITY_A_TYPES.localityRecorder);
    const db = container.get<DB<Commit, any, any>>(LOCALITY_A_TYPES.db);
    const commits = await localityRecorder.record();
    await db.writeLocalities(commits, "Commits");
}

topLevelAwaitWrapper();   
4.1.0

2 years ago

4.0.1

3 years ago

4.0.0

3 years ago

4.0.2

2 years ago

3.8.0

3 years ago

3.5.2

3 years ago

3.4.0

3 years ago

3.3.0

3 years ago

3.1.0

3 years ago

3.5.1

3 years ago

3.5.0

3 years ago

3.4.1

3 years ago

3.0.0

3 years ago

2.1.0

3 years ago

2.0.0

3 years ago

1.3.0

3 years ago

1.2.0

3 years ago

1.1.0

3 years ago

1.0.5

3 years ago

1.0.3

3 years ago