view mongoBenchMark/mongoBench.js @ 26:96fcae37c62a

fix mongoBenchMark
author tatsuki
date Mon, 04 May 2015 00:38:57 +0900
parents
children ea29bd59d9c8
line wrap: on
line source

use tatsuki

for (var j = 1; j <= 10; j++){
db.collection.drop();
for (var i = 1; i<= 100 * j ; 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.collection.insert(user);
}
print("insertEnd");
db.collection.createIndex({PersonId:1});

var date_obj = new Date();
var milliseconds = date_obj.getTime();
for (var i = 1; i<= 10000000 ; i++) {
  var PersonId = db.collection.find({PersonId:"p:9"});
}
var date_obj = new Date();
print(db.collection.count() + " " +  (date_obj.getTime() - milliseconds))
}