亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

顯示某筆記錄的某個欄位(node.js+mongodb)
伊謝爾倫
伊謝爾倫 2017-05-02 09:26:23
0
3
764

怎麼顯示某筆記錄的某個欄位(node.js+mongodb)?

伊謝爾倫
伊謝爾倫

小伙看你根骨奇佳,潛力無限,來學(xué)PHP伐。

全部回覆(3)
為情所困

使用mongoose應(yīng)該可以吧

給我你的懷抱

雷雷

滿天的星座

不妨看下文件:Collection#find(以下程式碼引用自文件)

// A simple query showing skip and limit
var MongoClient = require('mongodb').MongoClient,
  test = require('assert');
MongoClient.connect('mongodb://localhost:27017/test', function(err, db) {

  // Create a collection we want to drop later
  var collection = db.collection('simple_limit_skip_query');
  // Insert a bunch of documents for the testing
  collection.insertMany([{a:1, b:1}, {a:2, b:2}, {a:3, b:3}], {w:1}, function(err, result) {
    test.equal(null, err);

    // Perform a simple find and return all the documents
    collection.find({})
      .skip(1).limit(1).project({b:1}).toArray(function(err, docs) {
        test.equal(null, err);
        test.equal(1, docs.length);
        test.equal(null, docs[0].a);
        test.equal(2, docs[0].b);

        db.close();
    });
  });
});

注意find部分,應(yīng)該就是你要的內(nèi)容。

最新下載
更多>
網(wǎng)站特效
網(wǎng)站源碼
網(wǎng)站素材
前端模板