我正在考虑使用mongoose进行数据建模,但我需要使用持久层来使用Firebase。是否有可能实现这一目标?例如,覆盖数据CRUD的一些moongose方法?
答案 0 :(得分:-1)
可以使用插件来实现这一目标。执行以下步骤:
npm install mongoose-fire
对每种型号使用以下陈述:
const mongoose-fire = require('mongoose-fire');
exampleSchema.plugin(mongoose-fire);
访问事件:
Model.on('create')
Modle.on('update')
Model.on('update:<attr>')
Modle.on('remove')