-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_mongo_insert.py
35 lines (31 loc) · 1 KB
/
test_mongo_insert.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
from pymongo import MongoClient
import random
client = MongoClient('localhost', 27017)
db = client.test_database
collection = db.test_collection
docs = [{
'timestamp' : '2017-04-11 11:04:12',
'bssid' : 'DEADBEEFSFUOESIEWR',
'channel' : random.randint(0,100),
'ssid' : 'wiiiiiifi',
'strength' : -24,
'encryption' : 'WPA'
},
{
'timestamp' : '2017-04-11 11:01:12',
'bssid' : 'BEEOIEUDSJFLKSDJFF',
'channel' : random.randint(0,100),
'ssid' : 'iurtiruyiuyrwe',
'strength' : -20,
'encryption' : 'WPA'
},
{
'timestamp' : '2017-04-11 11:24:12',
'bssid' : 'BEEF2DJFSKJFLKJSFKJL',
'channel' : random.randint(0,100),
'ssid' : 'sdfjaskfjlkdfjglfdghfketa',
'strength' : -30,
'encryption' : 'WPA'
}]
result = collection.insert_many(docs)
print result.inserted_ids