<commit_before>require 'mongo'
require 'json'

connection = Mongo::Connection.new("nxmongo.slidev.org", 27017)
db = connection.db("sli")
coll = db.collection("system.profile")

cursor = coll.find()

arr=[]
totals={}
cursor.each do |doc|
  arr<<doc["ns"] unless arr.include?(doc["ns"])
  
  totals[doc["ns"]].nil? ? totals[doc["ns"]]=doc["millis"] : totals[doc["ns"]]+=doc["millis"]   
      
end

puts arr.inspect
puts totals.inspect<commit_msg>don't consider system collections when aggregating slow queries<commit_after>require 'mongo'
require 'json'

connection = Mongo::Connection.new("nxmongo.slidev.org", 27017)
db = connection.db("sli")
coll = db.collection("system.profile")

cursor = coll.find({"ns" => { "$nin" => ["sli.system.profile", "sli.system.namespaces", "sli.system.js"]}})

arr=[]
totals={}
cursor.each do |doc|
  arr<<doc["ns"] unless arr.include?(doc["ns"])
  
  totals[doc["ns"]].nil? ? totals[doc["ns"]]=doc["millis"] : totals[doc["ns"]]+=doc["millis"]   
      
end

puts arr.inspect
puts totals.inspect
{'fraction_non_alphanumeric': 0.2103213242453749, 'fraction_numerical': 0.009737098344693282, 'mean_word_length': 5.632258064516129, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '600263', 'n_tokens_mistral': 393, 'n_tokens_neox': 385, 'n_words': 68}