version-repo-mongo

1.0.0 • Public • Published

An extention to the version-repo package with a backend provided by MongoDB.

See version-repo for the general version-repo API.

Repositories Classes

MongoRepo (API: Asynchronous, Stored Types: Any)

A synchronous repository which keeps resources in memory.

Constructor parameters
  • collection: A MongoDB Collection object.

  • config: An object with the following attributes:

    • update: (optional) one of "latest" (default), "any", "none"
    • delete: (optional) one of "latest" (default), "any", "none"
Example:
var MongoClient = require("mongodb").MongoClient;
var MongoRepo = require("version-repo-node").MongoRepo;
 
MongoClient.connect(
    "mongodb://localhost:27017",
    (err, client) => {
        if (err) 
            throw err;
 
        var DBO = client.db("mydb");
 
        DBO.createCollection(
            "my-repo", 
            function(err, collection) {
 
                if (err) 
                    throw err;
 
                my_repo = new MongoRepo(collection);
            });
    });

Package Sidebar

Install

npm i version-repo-mongo

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

2.68 MB

Total Files

57

Last publish

Collaborators

  • jdthorpe