zoukankan      html  css  js  c++  java
  • mongo学习笔记

    1. show dbs #显示所有的数据库
    2. use user #进入 user数据库
    3. db #展示当前数据库
    4. show collections #显示数据库中的集合, 相当于表格
    5. db.runCommand({"dropDatabase":1}) /db.dropDatabase() #删除当前数据库
    ---------------------------------------------------------------------------
    6. db.user.save({"name":"hailong"}) #新增一条数据 有更新的作用 user表示集合 相当于表 use user 中的user表示库
    db.user.insert({"name":"hailong"}) #插入一条数据 单条或多条
    db.user.insertOne() #将单个文档插入到集合中
    db.user.insertMany() #将多个文档插入到集合中
    7. db.user.find() #查找集合中所有数据
    db.user.findOne() #查找集合中第一条数据 条件查找
    8. db.user.remove({"name":"hailong"}) #删除集合下 name=hailong的信息
    9. db.user.updata({"name":"hailong"},{"age":"12"}) #只会修改一条数据

    10. db.doctor.drop() 或 db.runCommand({"drop":"doctor"}) #删除doctor集合

    11. 封顶集合 自动删除早期的数据


    12. map reduce
    $collection = Yii::$app->mongodb->getCollection('score');
    $r = $collection->mapReduce('function () {emit(this.name,this.score);}', 'function (name, score) {return Array.sum(score);}','mapReduceScore');

    If the copyright belongs to the longfei, please indicate the source!!!
  • 相关阅读:
    AE开发 入门教程
    工作空间工厂 打开文件例子
    Delphi IDE使用的一些主要技巧
    动画演示 Delphi 2007 IDE 功能[2]
    Delphi的类与继承
    属性的自动完成
    DELPHI中函数、过程变量的声明与应用
    Delphi回车键切换焦点
    delphi 窗体的创建和释放
    delphi assigned函数的用法
  • 原文地址:https://www.cnblogs.com/longfeiPHP/p/15557403.html
Copyright © 2011-2022 走看看