biz9-data v2.2.9
BiZ9 Data
The BiZ9-Data Package is an object-relational mapper (ORM) data access layer using Node.js. The package consists of create, read, update and destroy (CRUD) methods to handle data access and manipulations. The framework is fast and used for rapid application development for scaling applications from 0 to millions of records seamlessly and effortless. New data is written and persisted to the MongoDB tables/collections. Fetching data is obtained from the server cache memory using Redis. Using MongoDB with Redis will speed up your overall application tremendously. This framework is used as a data access component for mobile and website applications. It is best suited to be used as a package within Express.js. It can also be utilized for other Javascript based applications.
The BiZ9-Data-Server is the ORM solution currently promoted for use with React, React-Native, Angular, and web based projects as a component of the data access stack.
Installation
Use the npm installer to install.
npm i biz9-data
Required
Contents
- Example with Express.js
- Data.open_db
- Data.close_db
- Data.update_item
- Data.get_item
- Data.delete_item
- Data.get_list
- Data.update_list
- Data.delete_list
- Credits
Example with Express.js
View the full working test example.
const { Data } = require("biz9-data");
// get_db_connect
function(){
let db_connect = {};
let data_config = {
APP_TITLE_ID:'mongo_database_app_title_id',
MONGO_IP:"0.0.0.0",
MONGO_USERNAME_PASSWORD:"",
MONGO_PORT_ID:"27019",
MONGO_SERVER_USER:"admin",
MONGO_CONFIG_FILE_PATH:'/etc/mongod.conf',
SSH_KEY:"",
REDIS_URL:"0.0.0.0",
REDIS_PORT_ID:"27019",
};
Data.open_db(data_config).then(([error,data]) => {
/*
db_connect = data;
*/
});
}
// update_item
function(){
let data_type = 'dt_blank';
let id = 0; // 0 intialize new data item;
let item =
{
data_type: 'dt_blank',
id: id,
title: 'title_6100',
first_name: 'first_name_6100',
last_name: 'last_name_6100',
user_name: 'user_name_6100',
test_group_id: 6100
};
Data.update_item(db_connect,data_type,item).then(([error,data]) => {
/*
data = {
data_type: 'dt_blank',
id: 'f54d788f-9fcb-4def-889f-5b7562741c99',
title: 'title_6100',
first_name: 'first_name_6100',
last_name: 'last_name_6100',
user_name: 'user_name_6100',
test_group_id: 6100,
date_create: '2025-02-10T17:55:31.629Z',
date_save: '2025-02-10T17:55:31.632Z',
app_title_id: 'mongo_database_app_title_id',
source: 'DB'
};
*/
});
}
// get_item
function(){
let data_type = 'dt_blank';
let id = 'f54d788f-9fcb-4def-889f-5b7562741c99';
Data.get_item(db_connect,data_type,id).then(([error,data]) => {
/*
data = {
data_type: 'dt_blank',
id: 'f54d788f-9fcb-4def-889f-5b7562741c99',
title: 'title_6100',
first_name: 'first_name_6100',
last_name: 'last_name_6100',
user_name: 'user_name_6100',
test_group_id: 6100,
date_create: '2025-02-10T17:57:55.024Z',
date_save: '2025-02-10T17:57:55.026Z',
source: 'DB'
}
*/
});
}
// delete_item
function(){
let data_type = 'dt_blank';
let id = 'f54d788f-9fcb-4def-889f-5b7562741c99';
Data.delete_item(db_connect,data_type,id).then(([error,data]) => {
/*
data = {
data_type: 'dt_blank',
id: 'ab70a896-5d65-422d-b12f-0c701f2cc95d',
cache_del: true,
db_del: true
};
*/
});
}
// close_db_connect
function(){
Data.close_db(db_connect).then(([error,data]) => {
/*
data = null;
*/
});
}
Data.open_db
Intialize and open Db connection.
Params
- Data config / Db configuration settings / object
let data_config = { APP_TITLE_ID:'mongo_database_title', MONGO_IP:"0.0.0.0", MONGO_USERNAME_PASSWORD:"", MONGO_PORT_ID:"27019", MONGO_SERVER_USER:"admin", MONGO_CONFIG_FILE_PATH:'/etc/mongod.conf', SSH_KEY:"", REDIS_URL:"0.0.0.0", REDIS_PORT_ID:"27019", };
Returns
- error / Error message / string
- db_connect / Open client Db connection / object
Example
let db_connect = {};
let data_config = {
APP_TITLE_ID:'mongo_database_title',
MONGO_IP:"0.0.0.0",
MONGO_USERNAME_PASSWORD:"",
MONGO_PORT_ID:"27019",
MONGO_SERVER_USER:"admin",
MONGO_CONFIG_FILE_PATH:'/etc/mongod.conf',
SSH_KEY:"",
REDIS_URL:"0.0.0.0",
REDIS_PORT_ID:"27019",
};
Data.open_db(data_config).then(([error,data]) => {
/*
db_connect = data;
*/
});
Data.close_db
Close Db connection.
Params
- db_connect / Open client Db connection / object
Returns
- error / Error message / string
- db_connect / Closed client Db connection / object
Example
Data.close_db(db_connect).then(([error,data]) => {
/*
data = null;
*/
});
Data.update_item
Create and or update data item.
Params
- db_connect / Open client Db connection / object
- id / Primary key / guid
- data_type / collection title / string
- item / data item / object
Returns
- error / Error message / string
- item / Data item / object
Example
let data_type = "dt_blank";
let id = "9f1aeca3-b466-4cae-af4e-35b3fe9f31a1"; // 0 = intialize new data item.
let item = {
id: id,
data_type:data_type,
title: 'title_438',
first_name: 'first_name_438',
last_name: 'last_name_438',
user_name: 'user_name_438',
test_group_id: 438
};
Data.update_item(db_connect,data_type,id,item).then(([error,data]) => {
/*
data = {
data_type: 'dt_blank',
id: '9f1aeca3-b466-4cae-af4e-35b3fe9f31a1',
title: 'title_438',
first_name: 'first_name_438',
last_name: 'last_name_438',
user_name: 'user_name_438',
test_group_id: 438,
date_create: '2025-02-10T02:16:46.137Z',
date_save: '2025-02-10T02:16:46.138Z',
app_title_id: 'mongo_database_title',
source: 'DB'
};
*/
});
Data.get_item
Get a data item.
Params
- db_connect / Open client Db connection / object
- data_type / collection title / string
- id / Primary key / guid
Returns
- error / Error message / string
- item / Data item / object
Example
let data_type = "dt_blank";
let id = "d31facf1-769e-48a6-a7d2-6c349e4b808e";
Data.get_item(db_connect,data_type,id).then(([error,data]) => {
/*
data = {
data_type: 'dt_blank',
id: 'd31facf1-769e-48a6-a7d2-6c349e4b808e',
title: 'title_450',
first_name: 'first_name_450',
last_name: 'last_name_450',
user_name: 'user_name_450',
test_group_id: 450,
date_create: '2025-02-10T02:16:46.137Z',
date_save: '2025-02-10T02:16:46.138Z',
app_title_id: 'mongo_database_title',
source: 'CACHE'
};
*/
});
Data.delete_item
Delete data item.
Params
- db_connect / Open client Db connection / object
- data_type / Collection title / string
- id / Primary key / guid
Returns
- error / Error message / string
- data / Empty data item / object
Example
let data_type = "dt_blank";
let id = "d31facf1-769e-48a6-a7d2-6c349e4b808e";
Data.delete_item(db_connect,data_type,id).then(([error,data]) => {
/*
data = {
data_type: 'dt_blank',
id: 'd31facf1-769e-48a6-a7d2-6c349e4b808e',
cache_del: true,
db_del: true
};
/*
});
Data.update_list
Create and or update data items.
Params
- db_connect / Open client Db connection / object
- data_type / collection title / string
- items / data items / list
Returns
- error / Error message / string
- items / Data items / list
Example
let data_type = "dt_blank";
let item_1 = {
id: 0,
data_type:'dt_blank',
title: 'title_438',
first_name: 'first_name_438',
last_name: 'last_name_438',
user_name: 'user_name_438',
test_group_id: 438
};
let item_2 = {
id: 0,
data_type:'dt_blank',
title: 'title_440',
first_name: 'first_name_440',
last_name: 'last_name_440',
user_name: 'user_name_440',
test_group_id: 440
};
let item_3 = {
id: 0,
data_type:'dt_blank',
title: 'title_450',
first_name: 'first_name_450',
last_name: 'last_name_450',
user_name: 'user_name_450',
test_group_id: 450
};
let data_item_list = [item_1, item_2, item_3];
Data.update_list(db_connect,data_type,data_item_list).then(([error,data]) => {
/*
data = [
{
data_type: 'dt_blank',
id: '33daeca3-d466-tcae-cf4e-55b3fe9f31a1',
title: 'title_438',
first_name: 'first_name_438',
last_name: 'last_name_438',
user_name: 'user_name_438',
test_group_id: 438,
date_create: '2025-02-10T02:16:46.137Z',
date_save: '2025-02-10T02:16:46.138Z',
app_title_id: 'mongo_database_title',
source: 'DB'
},
{
data_type: 'dt_blank',
id: '33daeca3-d466-tcae-cf4e-55b3fe9f31a1',
title: 'title_440',
first_name: 'first_name_440',
last_name: 'last_name_440',
user_name: 'user_name_440',
test_group_id: 440,
date_create: '2025-02-10T02:16:46.137Z',
date_save: '2025-02-10T02:16:46.138Z',
app_title_id: 'mongo_database_title',
source: 'DB'
},
{
data_type: 'dt_blank',
id: '33daeca3-d466-tcae-cf4e-55b3fe9f31a1',
title: 'title_450',
first_name: 'first_name_450',
last_name: 'last_name_450',
user_name: 'user_name_450',
test_group_id: 450,
date_create: '2025-02-10T02:16:46.137Z',
date_save: '2025-02-10T02:16:46.138Z',
app_title_id: 'mongo_database_title',
source: 'DB'
},
];
*/
});
Data.get_list
Get data items.
Params
- db_connect / Open client Db connection / object
- data_type / collection title / string
- filter / Selection criteria / object
- sort_by / Sort criteria / object
- page_current / Current page of paged list / int
- page_size / Paged list max count / int
Returns
- error / Error message / string
- items / Data items / list
- item_count / Total items found matching selection criteria / int
- page_count / Total number of pages in paged list / int
Example
let data_type = "dt_blank";
let filter = {first_name:'first_name_6100'};
let sort_by = {first_name:-1};
let page_current = 1;
let page_size = 10;
Data.get_list(db_connect,data_type,filter,sort_by,page_current,page_size).then(([error,data_list,item_count,page_count]) => {
/*
data_list = [
{
data_type: 'dt_blank',
id: '33daeca3-d466-tcae-cf4e-55b3fe9f31a1',
title: 'title_438',
first_name: 'first_name_6100',
last_name: 'last_name_438',
user_name: 'user_name_438',
test_group_id: 438,
date_create: '2025-02-10T02:16:46.137Z',
date_save: '2025-02-10T02:16:46.138Z',
app_title_id: 'mongo_database_title',
source: 'DB'
},
];
item_count = 10;
page_count = 5;
*/
});
Data.delete_list
Delete data items.
Params
- db_connect / Open client Db connection / object
- data_type / Collection title / string
- filter / Selection criteria / object
Returns
- error / Error message / string
- data / Empty data list / list
Example
let data_type = "dt_blank";
let filter = {first_name:'first_name_6100'};
Data.delete_list(db_connect,data_type,filter).then(([error,data]) => {
/*
data = [];
*/
});
Credits
Credits
Company
- BiZ9 Framework LLC
Code
Support
The BiZ9 Framework 🦾
The BiZ9 Framework is a developer friendly platform for building premium, polished, fast, professional and scalable business applications using the lastest rapid application development tools and techniques. The framework consists of libraries, commands, scripts, and packages for creating, maintaining, testing, and deploying both mobile and website applications. The primary 3rd party framework used are React, React Native, Node.js, ExpressJS, MongoDB, Nginx, Redis, Git, and Bash. The BiZ9 Framework focus is to be precise, routine, rapid, and customizable. The primary target devices for The BiZ9 Framework are Apple iOS, Android, Chrome, Safari, Firefox, and Edge. Other 3rd party Application Programming Interfaces (API) that are pre included are Amazon Web Service, Stripe and Bravely.
- Biz9 Framework GitHub
- Biz9 Framework Blog
- BoSS Mobile App Youtube Demo
TaNK9 Code 👽
Brandon Poole Sr also known as ‘TaNK’ is a technical lead and full stack software engineer with over 19 years of professional experience. He was born and raised in Atlanta, Ga and graduated with a Computer Information Systems Bachelor of Science Degree from Fort Valley State University. He is proficient in ASP.NET C#, ASP.NET MVC, .NET Core, Microsoft SQL Server, IIS Web Server, Node.js, React, React Native, Framework7, Redis, Amazon Web Services, Apple iOS, Android SDK, MongoDB, Redis, NGINX, and Git. He has worked as a software developer for Fortune 500 companies such as The Boeing Company, Georgia Pacific, Colonial Pipeline, Home Depot and United Parcel Services.
He is sometimes referred to as “the real Tank” from the movie The Matrix.
TagZ:
#BiZ9Framework
#BoSSAppZ
#Mobile
#Apple
#Android
#ApplicationDevelopment
#SoftwareFramework
#Cloud
#IOS
#Linux
#JavaScript
#NoSQL
#AppMoneyNoteZ
#TaNK9Code
Thank you for your time.
Looking forward to working with you.
License
4 months ago
4 months ago
5 months ago
4 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
5 months ago
7 months ago
7 months ago
7 months ago
7 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago