We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hey there,
I need to be able to use model document functions as documented here: https://dynamoosejs.com/guide/Model/#modelmethodsdocumentsetname-function
is there a way of doing it using this?
PS: Thanks for this great library!
The text was updated successfully, but these errors were encountered:
@schealex you can do the model initialization under the module directly like that
@Module({ imports: [ DynamooseModule.forFeature([ { name: 'notification', schema: NotificationSchema, }, ]), ], providers: [NotificationService], controllers: [NotificationController], }) export class NotificationModule implements OnModuleInit { constructor( @InjectModel('notification') private readonly notificationModel: any, ) {} onModuleInit() { this.notificationModel.methods.document.set('logMsg', (msg: string) => { console.log(msg); }); } }
later on, u can call this method as normal
@Injectable() export class NotificationService { constructor( @InjectModel('notification') private readonly model: Model<Notification, NotificationKey>, ) {} async findOne(key: NotificationKey) { const notification = await this.model.get(key); // @ts-ignore notification.logMsg('hello'); return notification; }
Sorry, something went wrong.
No branches or pull requests
Hey there,
I need to be able to use model document functions as documented here: https://dynamoosejs.com/guide/Model/#modelmethodsdocumentsetname-function
is there a way of doing it using this?
PS: Thanks for this great library!
The text was updated successfully, but these errors were encountered: