Mercurial > hg > Members > tatsuki > jungle-bench
comparison mongoBenchMark/insert.js @ 28:2ac12de0aaeb default tip
mongo BenchMark change
author | tatsuki |
---|---|
date | Tue, 05 May 2015 01:19:04 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
27:ea29bd59d9c8 | 28:2ac12de0aaeb |
---|---|
1 function insertData(personCount) { | |
2 db.person1.drop(); | |
3 db.config.drop(); | |
4 for (var i = 1; i<= personCount ; i++) { | |
5 | |
6 var user = { | |
7 | |
8 PersonId: "p:" + String(i), | |
9 type: "Person", | |
10 accountId: "a:26", | |
11 lastName: "LastName", | |
12 name: "name", | |
13 nameReading: "nameReading", | |
14 roleRefIds: [ | |
15 "r:10", | |
16 "r:34" | |
17 ] | |
18 , | |
19 parentOrganizations: { | |
20 type: "OrganizationMappedByRole", | |
21 OrganizationMappedByRole: [ | |
22 { | |
23 type: "OrganizationMappedByRole", | |
24 organizationRefId: "o:2", | |
25 roleRefId: "r:10" | |
26 }, | |
27 { | |
28 type: "OrganizationMappedByRole", | |
29 organizationRefId: "o:11", | |
30 roleRefId: "r:34" | |
31 } | |
32 ] | |
33 }, | |
34 priorities: { | |
35 type: "PriorityMappedByRole", | |
36 PriorityMappedByRole: [ | |
37 { | |
38 type: "PriorityMappedByRole", | |
39 priority: "0", | |
40 roleRefId: "r:10" | |
41 }, | |
42 { | |
43 type: "PriorityMappedByRole", | |
44 priority: "1", | |
45 roleRefId: "r:34" | |
46 } | |
47 ] | |
48 } | |
49 }; | |
50 | |
51 db.person1.insert(user); | |
52 } | |
53 | |
54 var config = { | |
55 configVer : "v:1", | |
56 PersonVer: "person1", | |
57 OrgVer: "org1", | |
58 RoleVer:"Role1" | |
59 } | |
60 db.person1.createIndex({PersonId:1}); | |
61 db.config.insert(config); | |
62 db.config.createIndex({configVer:1}); | |
63 } |