logo
  • 教程列表
  • SO官方文檔
  • Mongoose 庫
    • 使用 Mongoose 連線到 MongoDB
    • 使用 Mongoose Express.js 路由和文字運算子在 MongoDB 中查詢資料
    • 使用 Mongoose 和 Express.js 路由將資料儲存到 MongoDB
    • 使用 Mongoose 和 Express.js 路由在 MongoDB 中查詢資料
    • 模型中的索引
    • 有用的 Mongoose 功能
    • 使用 promises 在 mongodb 中查詢資料
  1. StackOverflow 文件
  2. Node.js 教程
  3. Mongoose 庫
  4. 有用的 Mongoose 功能

有用的 Mongoose 功能

Created: November-22, 2018

Mongoose 包含一些基於標準 find() 構建的內建函式。

doc.find({'some.value':5},function(err,docs){
    //returns array docs
});

doc.findOne({'some.value':5},function(err,doc){
    //returns document doc
});

doc.findById(obj._id,function(err,doc){
    //returns document doc
});
  • 使用 promises 在 mongodb 中查詢資料
  • 模型中的索引

Copyright © 2018. All right reserved

tastones.com 备案号:鲁ICP备18045372号-1

  • 關於本站
  • 免責聲明