kunlatek-crud
v0.1.2
Published
Generic CRUD entending to cover many sql ad nosql databases most simple processes with one syntax
Downloads
7
Readme
Generic CRUD entending to cover many sql ad nosql databases most simple processes with same POJO
##Installing
npm install --save kunlatek-crud@latest
##Last updates
- Dealing with basic mongodb queries
- Fixed returning mongodb queries
##Using Kunlatek CRUD ###Create
const create = require('kunlatek-crud');
const queryParams = {
entity: 'user',
method: 'create',
object: {
username: 'testingUsername',
password: 'testingassword',
email:'[email protected]',
emailVerified: 1,
inviter: 'testingInviter'
}
};
const connectionParams = {
connectionString: 'mongodb+srv://<domain>:<password>@domaincluster0-b0pfr.gcp.mongodb.net/test?retryWrites=true&w=majority',
databaseName: 'mongodb'
}
create.crud(queryParams, connectionParams);
###Read
const read = require('../index');
const queryParams = {
entity: 'user',
method: 'read',
conditions: {
username: 'testingUsername'
}
};
const connectionParams = {
connectionString: 'mongodb+srv://<domain>:<password>@domaincluster0-b0pfr.gcp.mongodb.net/test?retryWrites=true&w=majority',
databaseName: 'mongodb'
}
read.crud(queryParams, connectionParams);
###Update
const update = require('../index');
const queryParams = {
entity: 'user',
method: 'update',
conditions: {
username: 'testingUsername'
},
object: {
password: 'newPassword',
}
};
const connectionParams = {
connectionString: 'mongodb+srv://<domain>:<password>@domaincluster0-b0pfr.gcp.mongodb.net/test?retryWrites=true&w=majority',
databaseName: 'mongodb'
}
update.crud(queryParams, connectionParams);
###Delete
const deleteMethod = require('../index');
const queryParams = {
entity: 'user',
method: 'hardDelete',
conditions: {
username: 'testingUsername'
}
};
const connectionParams = {
connectionString: 'mongodb+srv://<domain>:<password>@domaincluster0-b0pfr.gcp.mongodb.net/test?retryWrites=true&w=majority',
databaseName: 'mongodb'
}
deleteMethod.crud(queryParams, connectionParams);