mongodb相关积累知识

    技术2023-11-01  111

    基础知识

     

    常见命令

    1.show dbs/databases  显示所有数据库    2use orderInfo 使用orderInfo数据库 3.show collections 4 db.orderInfo.find({"orderId":"xxx"}).pretty() 查询订单ID为xx的订单数据   5db.orderInfo.insert({"hello","one"})

    5.sql="db.test.insert({name:'test',age:1});"//定义执行的sqlecho "$sql"|/home/test/mongodb/mongodb-2.2.3/bin/mongo 127.0.0.1:8888/test --shell

    注意,echo命令中的格式必须这样写,管线命令后面的是是数据库安装地址 然后是ip:端口号,斜线后是数据库名称,--shell表示通过shell交互

     

    常见命令

    Processed: 0.015, SQL: 9