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))
     
     
     
     
     
  • 相关阅读:
    IDA 动态调试 ELF 文件
    双机调试环境搭建[win7+Windbg+VirtualKD]
    从域环境搭建到 MS14-068 提升为域权限
    栈溢出原理与 shellcode 开发
    Flask_0x05 大型程序结构
    rest-framework 框架的基本组件
    restful 规范
    Django的CBV和FBV
    Django-model 进阶
    Django-Ajax
  • 原文地址:https://www.cnblogs.com/ericblog1992/p/13088401.html
Copyright © 2011-2022 走看看