1.0.1 • Published 2 years ago
mongoose-anonymoose v1.0.1
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-anonymoosenpm
npm i mongoose-anonymoosepnpm
pnpm i mongoose-anonymoosebun.js
bun install mongoose-anonymooseUsage
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;
}
}