class MongoAccessor
Public Class Methods
new(url, collection, client_host)
click to toggle source
# File lib/logstash/inputs/mongoprofile.rb, line 69 def initialize(url, collection, client_host) connection = Mongo::Client.new(url) @mongodb = connection.database @collection = @mongodb.collection(collection) @client_host = client_host end
Public Instance Methods
get_documents(limit)
click to toggle source
# File lib/logstash/inputs/mongoprofile.rb, line 81 def get_documents(limit) @collection.find({:client => {:$ne => @client_host}}).limit(limit).sort(:ts => 1) end
get_documents_by_ts(date, limit)
click to toggle source
# File lib/logstash/inputs/mongoprofile.rb, line 77 def get_documents_by_ts(date, limit) @collection.find({:ts => {:$gt => DateTime.parse(date) + 0.00002}, :client => {:$ne => @client_host}}).limit(limit).sort(:ts => 1) end