#708: done, reports index

This commit is contained in:
amartynov 2015-09-15 14:13:35 +03:00
parent 7ead58ff91
commit e1d1b99ae9
2 changed files with 13 additions and 0 deletions

View File

@ -14,12 +14,24 @@ module Devops
mongo_user = config[:mongo_user]
mongo_password = config[:mongo_password]
@@db = MongoConnector.new(mongo_db, mongo_host, mongo_port, mongo_user, mongo_password)
create_indexes
end
def connector
@@db
end
def create_indexes
reports_coll = @@db.reports_connector
info = reports_coll.index_information
unless info["created_at_1"]
reports_coll.create_index({created_at: Mongo::ASCENDING})
end
unless info["project_1_deploy_env_1_created_at_1"]
reports_coll.create_index({project: Mongo::ASCENDING, deploy_env: Mongo::ASCENDING, created_at: Mongo::ASCENDING})
end
end
end
end
end

View File

@ -39,6 +39,7 @@ module Connectors
options.delete("date_to")
options["created_at"] = date unless date.empty?
end
puts "Reports: #{options}"
list(options)
end