zoukankan      html  css  js  c++  java
  • mac 安装mongodb与常用操作

    1.安装

    brew update

    brew install mongodb

    2.启动mongo

    mongod --config /usr/local/etc/mongod.conf

    3.启动

    mongo

    4.python 链接mongo

    from pymongo import MongoClient
    client = MongoClient('localhost',27017)

    5.选择使用的数据库(以test为例)

    db = client.test
    collection = db.test

    6.添加信息

    new_mess = {'name':'Jason','Age':'35','Habit':'Singing'}
    collection.insert(new_mess)

    7.修改信息

    collection.update({"name":"Jason"},{"$set":{"name":"Jason Zhang"}})

    8.删除信息

    collection.remove({'Habit':"draw"})

    9.查询信息

    collection.find({"name":"Jason Zhang"})

    然后现在就看了最近简单的操作。

  • 相关阅读:
    Assimp对FBX文件中geometric transformations的处理
    VSM
    WSL安装
    [p1880][NOI1995]石子合并
    【日常】集训总结
    【模板】背包
    【济南集训】20191006解题报告
    [P1516]青蛙的约会
    【模板】ST表
    【济南集训】20191001解题报告
  • 原文地址:https://www.cnblogs.com/chenyang920/p/7774963.html
Copyright © 2011-2022 走看看