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))
     
     
     
     
     
  • 相关阅读:
    php 扩展模块安装过程
    nginx 配置若干问题
    df 显示 100%的问题
    pcre 不支持 utf 的问题
    服务器TCP连接中 TIME_WAIT 状态过多
    Linux 运维笔试题(一)答案
    Linux 运维笔试题(一)
    Java 内存监控(一)之 jps命令
    python 入门
    Java 内存监控命令简介(零)
  • 原文地址:https://www.cnblogs.com/ericblog1992/p/13088401.html
Copyright © 2011-2022 走看看