
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
@webgap/database-dao
Advanced tools
This is the WebGAP DatabaseDAO module.
Handles abstraction for multiple database systems.
Handles logging using @webgap/logger.
Loads default configuration using @webgap/configuration.
MongoDB Driver mongodb.
JSON File System @webgap/jsonfs.
A configuration file must exist (check @webgap/configuration documentation).
npm install @webgap/database-dao --save
// using jsondbfs driver
var options = {
databaseDriver: 'jsondbfs',
collectionName: 'UserCollection',
connectionString: '/path/to/store/json/files'
};
var UserDAO = new DAO(options);
UserDAO.getClient(function (err, client) {
client.insert({name: "teste", age: 33}, callback);
client.createIndex({name: "teste"}, callback);
client.find({name: "teste"}, callback);
client.findOne({name: "teste"}, callback);
client.findAndModify({name: "teste"}, {name: "teste", age: 34},callback);
client.update({name: "teste"}, {name: "teste1", age: 33},callback);
client.remove({name: "teste1", age: 33}, callback);
});
// or using mongodb driver
var options = {
databaseDriver: 'mongodb',
collectionName: 'UserCollection',
connectionString: 'mongodb://user:pass@host:port'
};
var UserDAO = new DAO(options);
UserDAO.getClient(function (err, client) {
client.insert({name: "teste", age: 33}, callback);
client.createIndex({name: "teste"}, callback);
client.find({name: "teste"}, callback);
client.findOne({name: "teste"}, callback);
client.findAndModify({name: "teste"}, {name: "teste", age: 34},callback);
client.update({name: "teste"}, {name: "teste1", age: 33},callback);
client.remove({name: "teste1", age: 33}, callback);
});
The object 'options' should contain (at least) the following attributes:
var options = {
collectionName: 'name' //the name of the collection
};
Other options include:
var options = {
databaseDriver: 'jsondbfs', //one of mongodb or jsondbfs
connectionString: '/tmp' // the path to the database. if jsonfs is a filesystem location otherwise if is mongodb should be a mongo db url: mongodb://user:pass@host:port
};
If no 'options' is provided, the module will try to load the settings from @webgap/configuration module.
DB.DRIVER - Defaults to 'jsondbfs'
DB.CONNECTION_STRING - Defaults to '/tmp/'
Apache License, Version 2.0
FAQs
Database data access object abstraction module.
The npm package @webgap/database-dao receives a total of 4 weekly downloads. As such, @webgap/database-dao popularity was classified as not popular.
We found that @webgap/database-dao demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.