-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Peng Xiao <[email protected]>
- Loading branch information
1 parent
7127e43
commit ac5491a
Showing
26 changed files
with
371,448 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
db.createUser( | ||
{ | ||
user : "admin", | ||
pwd : "admin", | ||
roles: [ | ||
{ | ||
role : "readWrite", db : "admin"}, | ||
{ | ||
role: "userAdminAnyDatabase", | ||
db : "admin" | ||
} | ||
] | ||
} | ||
) |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import random | ||
import string | ||
|
||
res = [] | ||
min_char = 100 | ||
max_char = 200 | ||
allchar = string.ascii_letters + string.punctuation + string.digits | ||
|
||
|
||
for i in range(100000): | ||
tmp = {} | ||
tmp['testkey'] = random.randint(1, 10000) | ||
tmp['testtext'] = "".join(random.choice(allchar) for x in range(random.randint(min_char, max_char))) | ||
res.append(tmp) | ||
|
||
f = open('shard_data.json', 'w') | ||
import json | ||
json.dump(res, f) | ||
f.close() |
File renamed without changes.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
db.dropDatabase() | ||
|
||
db.customer.insertMany( | ||
[ | ||
{ | ||
"_id": 1, | ||
"name": "John Cart", | ||
"email": "[email protected]", | ||
"phone": 12345, | ||
"orders": [1, 2, 3] | ||
}, | ||
{ | ||
"_id": 2, | ||
"name": "Arber Su", | ||
"email": "[email protected]", | ||
"phone": 56789, | ||
"orders": [4, 5] | ||
} | ||
]) | ||
|
||
db.order.insertMany( | ||
[ | ||
{ | ||
"_id": 1, | ||
"date": "2018-12-10", | ||
"product": "book", | ||
"cost": 19.99 | ||
}, | ||
{ | ||
"_id": 2, | ||
"date": "2018-12-13", | ||
"product": "book", | ||
"cost": 39.99 | ||
}, | ||
{ | ||
"_id": 3, | ||
"date": "2018-12-22", | ||
"product": "computer", | ||
"cost": 2899 | ||
}, | ||
{ | ||
"_id": 4, | ||
"date": "2018-12-01", | ||
"product": "book", | ||
"cost": 19.99 | ||
}, | ||
{ | ||
"_id":5, | ||
"date": "2018-12-29", | ||
"product": "computer", | ||
"cost": 2899 | ||
} | ||
] | ||
) | ||
|
||
db.customer.aggregate([{$lookup: {from: "order", localField:"orders",foreignField: "_id", as: "order_details"}}]).pretty() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"_id": 1, | ||
"name": "John Cart", | ||
"email": "[email protected]", | ||
"phone": 12345, | ||
"address": 1 | ||
} | ||
|
||
{ | ||
"_id": 1, | ||
"city": "Shanghai", | ||
"street": "aaaaa", | ||
"building": 1, | ||
"unit": 2, | ||
"room": 1021 | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
[ | ||
{ | ||
"name": "Jack", | ||
"age": 27, | ||
"hobby": [ | ||
{ | ||
"type": "Movie", | ||
"rating": 3 | ||
}, | ||
{ | ||
"type": "Sports", | ||
"rating": 6 | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "Mark", | ||
"age": 25, | ||
"hobby": [ | ||
{ | ||
"type": "Movie", | ||
"rating": 2 | ||
}, | ||
{ | ||
"type": "Cook", | ||
"rating": 5 | ||
}, | ||
{ | ||
"type": "Music", | ||
"rating": 4 | ||
} | ||
] | ||
} | ||
] |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
[ | ||
{ | ||
"name": "Jack", | ||
"age": 27, | ||
"hobby": [ | ||
{ | ||
"type": "Movie", | ||
"rating": 3 | ||
}, | ||
{ | ||
"type": "Sports", | ||
"rating": 6 | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "Mark", | ||
"age": 25, | ||
"hobby": [ | ||
{ | ||
"type": "Movie", | ||
"rating": 2 | ||
}, | ||
{ | ||
"type": "Cook", | ||
"rating": 5 | ||
}, | ||
{ | ||
"type": "Music", | ||
"rating": 4 | ||
} | ||
] | ||
} | ||
] |
Oops, something went wrong.