mongoose 查询 find 指定字段
生活随笔
收集整理的這篇文章主要介紹了
mongoose 查询 find 指定字段
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
在第二個參數中填寫字符串,需要查詢的字段用空格相連。
const Person = mongoose.model('Person', yourSchema); // 查詢每個 last name 是 'Ghost' 的 person, select `name` 和 `occupation` 字段 Person.findOne({ 'name.last': 'Ghost' }, 'name occupation');官方文檔 https://cn.mongoosedoc.top/docs/queries.html
總結
以上是生活随笔為你收集整理的mongoose 查询 find 指定字段的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 二次规划问题和MATLAB函数quadp
- 下一篇: css3-6 表格如何设置样式和定位样式