geoIntersects,$geoWithin,$near,$nearSphere
// 创建stations集合
const stations = db.collection("stations");
// 添加测试数据...$maxDistance: 1000
}
}
}).toArray();
console.log("天安门附近地铁站", r);
更新操作符:可以修改数据库数据或添加附加数据...} }
// 数组相关:$,$[],$addToSet,$pull,$pop,$push,$pullAll
// $push用于新增
insertOne({tags: ['热带','甜']}) //添加...删除首项-1或尾项1
fruitsColl.updateMany({ name: "芒果" }, { $pop: {tags: 1}})
fruitsColl.updateMany({ name: "...BlogModel({...});
// 调用实例方法
r = await blog.findByAuthor();
console.log('findByAuthor', r);
你还可以把这个方法作为静态属性直接绑定到