diff --git a/example/rails-51/lib/tasks/resque:setup.rake b/example/rails-51/lib/tasks/resque_setup.rake similarity index 100% rename from example/rails-51/lib/tasks/resque:setup.rake rename to example/rails-51/lib/tasks/resque_setup.rake diff --git a/example/rails-60/lib/tasks/resque:setup.rake b/example/rails-60/lib/tasks/resque_setup.rake similarity index 100% rename from example/rails-60/lib/tasks/resque:setup.rake rename to example/rails-60/lib/tasks/resque_setup.rake diff --git a/lib/bugsnag/integrations/mongo.rb b/lib/bugsnag/integrations/mongo.rb index e1b2d22d0..42f01416b 100644 --- a/lib/bugsnag/integrations/mongo.rb +++ b/lib/bugsnag/integrations/mongo.rb @@ -60,6 +60,7 @@ def leave_mongo_breadcrumb(event_name, event) filter = sanitize_filter_hash(command["filter"]) meta_data[:filter] = JSON.dump(filter) end + meta_data[:sort] = JSON.dump(command["sort"]) unless command["sort"].nil? end meta_data[:message] = event.message if defined?(event.message) diff --git a/spec/integrations/mongo_spec.rb b/spec/integrations/mongo_spec.rb index fc2594ebe..e1bfe9c2e 100644 --- a/spec/integrations/mongo_spec.rb +++ b/spec/integrations/mongo_spec.rb @@ -174,6 +174,27 @@ def require(path) ) subscriber.send(:leave_mongo_breadcrumb, event_name, event) end + + it "adds a JSON string of sort data" do + command["sort"] = {"a" => 1, "b" => -1} + expect(subscriber).to receive(:pop_command).with("123456").and_return(command) + expect(Bugsnag).to receive(:leave_breadcrumb).with( + "Mongo query #{event_name}", + { + :event_name => "mongo.#{event_name}", + :command_name => "command", + :database_name => "database", + :operation_id => "1234567890", + :request_id => "123456", + :duration => "123.456", + :collection => "collection_name_command", + :sort => '{"a":1,"b":-1}' + }, + "process", + :auto + ) + subscriber.send(:leave_mongo_breadcrumb, event_name, event) + end end end