1.0.0 • Published 7 months ago
mongoose-anonymoose v1.0.0
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;
}
}
1.0.0
7 months ago