version-repo-mongo
v1.0.0
Published
A mongodb based version-repo data store
Downloads
3
Maintainers
Readme
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);
});
});