2021年11月18日 星期四

Install MongoDB Compass on Ubuntu 20 2021

 https://www.how2shout.com/linux/install-mongodb-compass-gui-in-ubuntu-20-04-lts-linux/


https://www.mongodb.com/try/download/compass

mongodb-compass_1.29.4_amd64.deb


sudo apt install ./mongodb-compass_*_amd64.deb


MongoDB Compass

mongodb+srv://<leung>:<password>@cluster0.j807r.mongodb.net/test


a.py


import pymongo

from pymongo import MongoClient

with open('url.txt', 'r') as infile:

    url = infile.read()

connection = MongoClient(url)

print('list_database_names', connection.list_database_names())

db = connection.testdb

collection = db['instruments']

mydict = { "name": "RUNOOB", "age": 5, "url": "https://www.runoob.com" }

inserted = collection.insert_one(mydict) 

print(type(inserted))

print(inserted)


updated = collection.update_one({'name':'RUNOOB'}, {'$inc': {'age':1}}) 

print(type(updated))

print(updated)

沒有留言:

張貼留言

2023 Promox on Morefine N6000 16GB 512GB

2023 Promox on Morefine N6000 16GB 512GB Software Etcher 100MB (not but can be rufus-4.3.exe 1.4MB) Proxmox VE 7.4 ISO Installer (1st ISO re...