view mongoBenchMark/insert.js @ 28:2ac12de0aaeb default tip

mongo BenchMark change
author tatsuki
date Tue, 05 May 2015 01:19:04 +0900
parents
children
line wrap: on
line source

function insertData(personCount) {
db.person1.drop();
db.config.drop();
for (var i = 1; i<= personCount  ; i++) {

    var user = {
   
    PersonId: "p:" + String(i),
    type: "Person",
    accountId: "a:26",
    lastName: "LastName",
    name: "name",
    nameReading: "nameReading",
    roleRefIds: [
        "r:10",
        "r:34"
      ]
    ,
    parentOrganizations: {
      type: "OrganizationMappedByRole",
      OrganizationMappedByRole: [
        {
          type: "OrganizationMappedByRole",
          organizationRefId: "o:2",
          roleRefId: "r:10"
        },
        {
          type: "OrganizationMappedByRole",
          organizationRefId: "o:11",
          roleRefId: "r:34"
        }
      ]
    },
    priorities: {
      type: "PriorityMappedByRole",
      PriorityMappedByRole: [
        {
          type: "PriorityMappedByRole",
          priority: "0",
          roleRefId: "r:10"
        },
        {
          type: "PriorityMappedByRole",
          priority: "1",
          roleRefId: "r:34"
        }
      ]
    }
  };

  db.person1.insert(user);
}

var config = {
  configVer : "v:1",
  PersonVer: "person1",
  OrgVer: "org1",
  RoleVer:"Role1"
}
db.person1.createIndex({PersonId:1});
db.config.insert(config);
db.config.createIndex({configVer:1});
}