在第二个参数中填写字符串,需要查询的字段用空格相连。
const Person mongoose.model(Person, yourSchema);
// 查询每个 last name 是 Ghost 的 person, select name 和 occupation 字段
Person.findOne({ name.last: Ghost }, name occupation);官方…
使用插件mongoose-paginate进行分页查询,这个库已经2年不更新了,但下载量还是比较大的。 地址https://www.npmjs.com/package/mongoose-paginate 列举开发过程中常用的代码片段: 1、查询某个字段 使用select: title date author
var query …