我常用的 mongoose API

日期:2020-08-20

作者:科技微讯

不用 schema 呢

Model.$where('this.firstname === this.lastname').exec(callback)
Model.find({
    city: {$regex: new RegExp('guangzhou')},
    location_type: 'supercharger'
}).lean().select('city added_date -something')

https://masteringjs.io/tutorials/mongoose/update

find({"a:b":"c"})

replaceOne vs. updateOne

replaceOne

supercharger.findOne({ nid: site.nid, geocode: site.geocode }) .lean() .then(res => {

const users = await userTestModel.find({'sub.apple.sub': 'iOS'}).exec()