-
Notifications
You must be signed in to change notification settings - Fork 0
/
mongotest.py
46 lines (39 loc) · 1.21 KB
/
mongotest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
from pymongo import MongoClient
import json, time, sys
print (__name__)
start_time = time.time()
client = MongoClient('mongodb://1.1.1.1')
print("--- %s seconds ---" % (time.time() - start_time))
db = client.mycompany
print("--- %s seconds ---" % (time.time() - start_time))
customers = db.customers
print("--- %s seconds ---" % (time.time() - start_time))
print(sys.getsizeof(customers))
CUSTs=list(customers.find({} ))
print(sys.getsizeof(CUSTs))
print("--- %s seconds ---" % (time.time() - start_time))
i=1
for user in CUSTs:
try:
print(i,". email: ",user["structure"]["email"],"")
print("Name: ",user["structure"]["name"])
print("Date: ",user["date"],"\n")
i +=1
except:
print(user["uuid"]," has no email \n")
# #print(len(CUSTs)
# print("\n------------------------\n")
# i=1
# for user in CUSTs:
# if "mycompany.com" in user["structure"]["email"] or "stepcart" in user["structure"]["email"] :
# print(i,". email: ",user["structure"]["email"],"")
# print("Name: ",user["structure"]["name"],"\n")
# i +=1
# mapping = db.mappings
# MAPS=list(mapping.find({} ))
# j=1
# for ruls in MAPS:
# print(ruls["emitter"])
# for rul in ruls["rules"]:
# print(j,rul["rule"]["src"]," - ",rul["rule"]["dst"])
# j+=1