Get the App
SLTechnology News&Howtos  ›  Database  › 

[Python] pymongo link mongo

Shulou Source: shulou.com Published: 2022-06-01 04:43:30 11月13日 Update

Pymongo module link mongo

1. Link single instance mongo

#-*-coding: utf-8-*-

Import datetime

Import pymongo

Import time

Client = pymongo. MongoClient ("127.0.0.1" 27017)

Db = client. Get_database ("collection")

Db. Authenticate ('collection',' 78hRdJEnJcHRb4qA')

# print (db. Collection_names ()

Redefine_collection = db. Get_collection ('redefine-collection')

Alluser= []

Demos = redefine_collection. Find ({'event_id':' 0109001', 'event_info.url': {' $exists': 'true'}, "ctime": {"$gte": 1525881600000}}, no_cursor_timeout = True)

For item in demos:

If len (item ['event_info'] [' url']. Replace (r'/','). Split ('.) [- 1])

Tags: Users links instances common modules references Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno MySQL Shulou Information MariaDB Shulou Tech Info