1.0.4 • Published 5 years ago
@holofy/skill-store-schema v1.0.4
skill-store-schema
About
MongoDB schema
@holofy/skill-store-schema provides models for interacting with database objects.
Usage
Install the package
npm install @holofy/skill-store-schema --save-prod
Import as necessary:
const db = require('@holofy/schema');
const models = db(config.db);
To test on DeV
Add .env to project root folder
DB_USER=
DB_PASSWORD=
DB_HOST=
DB_PORT=
DB_NAME=
Add /sandbox/index.js to project root folder
require('dotenv').config();
const db = require('../index');
const models = db({
user: process.env.DB_USER,
password: process.env.DB_PASSWORD,
host: process.env.DB_HOST,
port: process.env.DB_PORT,
database: process.env.DB_NAME,
});
models.Space.findOne({}).then((res) => console.log(res));
On terminal
node sandbox/index.js
Please do not commit sandbox/* and .env
Seed to collection
md-seed run // to seed to databases
md-seed run <CollectionName> // to seed that perticular collection
md-seed run --dropdb // drop db before seeding
Publish New Package
Only once: In this repository: Add NPM_AUTH_TOKEN to GitLab -> Settings -> CI/CD -> Settings -> Variables
git add .
git commit
npm version [major | minor | patch]