Security News
cURL Project and Go Security Teams Reject CVSS as Broken
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
@nestjsbase/mongoose
Advanced tools
This is a library includes inheritable classes that can help you to save your time when create CRUD module in NestJS. This classes are supporting for mongoose. If you want to use typeorm instead, you can go [here](https://www.npmjs.com/package/@nestjsbase
This is a library includes inheritable classes that can help you to save your time when create CRUD module in NestJS. This classes are supporting for mongoose. If you want to use typeorm instead, you can go here
npm install @nestjsbase/mongoose
First, you have create your own entity class and inherit BaseModel of @nestjsbase/mongoose
import { Schema, Prop } from '@nestjs/mongoose';
import { BaseModel } from '@nestjsbase/mongoose';
@Schema({ timestamp: true })
export class UserModel extends BaseModel {
@Prop()
name!: string;
}
You have to enable timestamp if you want to use createdAt and updatedAt
This is BaseModel actually do in background
export class BaseModel {
@Prop({ type: Date })
createdAt!: Date;
@Prop({ type: Date })
updatedAt!: Date;
@Prop({ type: Date })
deletedAt!: Date;
}
Now, make your service inherit BaseService
import { Model } from 'mongoose';
import { BaseService } from '@nestjsbase/mongoose';
import { Injectable } from '@nestjs/common';
import { InjectModel } from '@nestjs/mongoose';
import { UserModel } from '../user.model';
@Injectable()
export class UserService extends BaseService {
constructor(@InjectModel(UserModel.name) private userModel: Model<UserModel>){
super(userModel);
}
}
This BaseService already have methods:
export class IBaseService {
create(...);
createMany(...);
getOne(...);
getOneOrFail(...);
getOneById(...);
getOneByIdOrFail(...);
getAll(...);
getAllWithPagination(...);
update(...);
updateById(...);
remove(...);
removeById(...);
softRemove(...);
softRemoveById(...);
}
export interface IPagination<T> {
data: T[];
pagination: {
limit: number;
page: number;
total: number;
};
}
FAQs
This is a library includes inheritable classes that can help you to save your time when create CRUD module in NestJS. This classes are supporting for mongoose. If you want to use typeorm instead, you can go [here](https://www.npmjs.com/package/@nestjsbase
We found that @nestjsbase/mongoose demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
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.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.