
Security News
Node.js TSC Votes to Stop Distributing Corepack
Corepack will be phased out from future Node.js releases following a TSC vote.
@kaudal/models
Advanced tools
[](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
[](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
Corepack will be phased out from future Node.js releases following a TSC vote.
Research
Security News
Research uncovers Black Basta's plans to exploit package registries for ransomware delivery alongside evidence of similar attacks already targeting open source ecosystems.
Security News
Oxlint's beta release introduces 500+ built-in linting rules while delivering twice the speed of previous versions, with future support planned for custom plugins and improved IDE integration.