mongoose-anonymoose
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

Mongoose Anonymoose

Description

This plugin removes _id and __v fields from the objects when you call the methods toJson and toObject.

Installation

yarn

yarn add mongoose-anonymoose

npm

npm i mongoose-anonymoose

pnpm

pnpm i mongoose-anonymoose

bun.js

bun install mongoose-anonymoose

Usage

Connection scope

connection = await mongoose.connect(options)
connection.plugin(anonymoose);

Query level scope

export class UsersRepository {
    public async findOne(uuid: string): Promise<User> {
        const user = await UserModel.findOne({ uuid });
        if (user) {
            return User.instance(user.toJson());
        }
    
        return null;
    }
}


Readme

Keywords

none

Package Sidebar

Install

npm i mongoose-anonymoose

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

3.6 kB

Total Files

4

Last publish

Collaborators

  • fdorantesm