benchmark/benchmark_indexes.js
/**
 * Helper method for populating a collection
 * @param {*} db loki database instance containing collection to populate
 * @param {*} count number of documents to insert
 */
Helper method for populating a collection
@param {*} db loki database instance containing collection to populate
@param {*} count number of documents to insert
Helper method for populating a collection @param { * } db loki database instance containing collection to populate @param { * } count number of documents to insert
function populateDatabase(db, count) {
  let coll = db.getCollection("perfcoll");
  let idxbuf = [];
  let customIdx, v1;
  for (let idx = 0; idx < count; idx++) {
    customIdx = count - idx;
    idxbuf.push(customIdx);
    v1 = genRandomVal();
    coll.insert({
      customId: customIdx,
      val: v1,
      val2: "more data 1234567890"
    });
  }
  return idxbuf;
}
function populateDatabase ( db , count ) { let coll = db . getCollection ( "perfcoll" ) ; let idxbuf = [ ] ; let customIdx , v1 ; for ( let idx = 0 ; idx < count ; idx ++ ) { customIdx = count - idx ; idxbuf . push ( customIdx ) ; v1 = genRandomVal ( ) ; coll . insert ( { customId : customIdx , val : v1 , val2 : "more data 1234567890" } ) ; } return idxbuf ; }
Helper method for populating a collection
 @param {*} db loki database instance containing collection to populate
 @param {*} count number of documents to insert
Helper method for populating a collection @param { * } db loki database instance containing collection to populate @param { * } count number of documents to insert
// populate collection