Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
@kaudal/models
Advanced tools
[![Build Status](https://travis-ci.com/Kaudal/models.svg?branch=main)](https://travis-ci.com/Kaudal/models)
This module is meant to be used with Node.js and expects the Node.js version of
the mongoose
module as an argument. If you are
looking for schemas to be used in the front-end please check
Laboratoria/schemas
.
npm install --save @Kaudal/models
For more detailed information, please check the
official mongoose
docs
Creating and saving a model:
const mongoose = require('mongoose');
const { Project } = require('models')(mongoose);
const project = new Project({
slug: 'cipher',
repo: 'Laboratoria/curricula-js',
path: 'projects/01-cipher',
// ...
});
project.save()
.then(console.log)
.catch(console.error);
Finding models:
// Querying for all documents in collection
Project.find({}, (err, docs) => {
if (err) {
console.error(err);
}
// doc something with `docs`...
});
// Alternatively using a promise
Project.find({})
.then(console.log)
.catch(console.error);
Using Model.validate
as a Promise
:
const mongoose = require('mongoose');
const { Project } = require('models')(mongoose);
const project = new Project({
slug: 'cipher',
repo: 'Laboratoria/curricula-js',
path: 'projects/01-cipher',
// ...
});
project.validate()
.then(() => {
// Validation succeeded ;-)
})
.catch((err) => {
// Validation failed :-(
});
Using Model.validate
with a callback:
const mongoose = require('mongoose');
const { Project } = require('models')(mongoose);
// Creating a new instance of a Model
const project = new Project({
slug: 'cipher',
repo: 'Laboratoria/curricula-js',
path: 'projects/01-cipher',
// ...
});
// Validating model instance
project.validate((err) => {
// ...
});
Unit tests (and linter):
yarn test
End-to-end tests:
yarn e2e
Cohort
CohortMembership
CohortTopic
CohortTopicEmail
CohortTopicSettings
CohortReport
CohortProject
CohortPlatziCourse
(deprecated)CohortPairs
GraduateProfile
GraduateProfileEndorsement
GraduateProfileProject
GraduateProfileLifeSkill
(deprecated)User
UserActivityFeedEvent
AcademicProfileCommentEvent
AcademicProfileTagAssignedEvent
AcademicProfileTagRemovalEvent
ReviewAnswerEvent
See Laboratoria/schemas
.
FAQs
[![Build Status](https://travis-ci.com/Kaudal/models.svg?branch=main)](https://travis-ci.com/Kaudal/models)
The npm package @kaudal/models receives a total of 0 weekly downloads. As such, @kaudal/models popularity was classified as not popular.
We found that @kaudal/models demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers 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
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.