zoukankan      html  css  js  c++  java
  • 查询

     

     

    // 查询所有用户集合中的文档
    // User.find().then(result => console.log(result));


    // 查询一条 
    // User.find({
    //     _id: '5c09f294aeb04b22f8460969'
    // }).then(result => console.log(result));

    // findOne  查询一条 
    // User.findOne({
    //     _id: '5c09f294aeb04b22f8460969'
    // }).then(result => console.log(result));

    // 大于20 小于40 的
    // User.find({
    //         age: { $gt: 20, $lt: 40 }
    //     })
    //     .then(result => console.log(result))


    // 查询 爱好 包含 足球的
    // User.find({
    //     hobbies: { $in: ['足球'] }
    // }).then(result => console.log(result))

    // 查询 包含 name email 的字段
    // User.find().select('name email')
    //     .then(result => console.log(result))

    // -_id  表示 不显示 id 字段
    // User.find().select('name email -_id')
    //     .then(result => console.log(result))


    // // 根据年龄升序排序
    // User.find().sort('age')
    //     .then(result => console.log(result))


    // 根据年龄降序
    // User.find().sort('-age')
    //     .then(result => console.log(result))

    User.find().skip(2).limit(3)
        .then(result => console.log(result))
     
     
     
     
     
  • 相关阅读:
    POJ 2752 Seek the Name, Seek the Fame
    POJ 2406 Power Strings
    KMP 算法总结
    SGU 275 To xor or not to xor
    hihocoder 1196 高斯消元.二
    hihoCoder 1195 高斯消元.一
    UvaLive 5026 Building Roads
    HDU 2196 computer
    Notions of Flow Networks and Flows
    C/C++代码中的笔误
  • 原文地址:https://www.cnblogs.com/ericblog1992/p/13088401.html
Copyright © 2011-2022 走看看