Watch keynotes and sessions from MongoDB.live, our virtual developer conference.

Mongo::Error::NoServerAvailable while making bulk write call

I am trying to do Bulk write API call through Ruby to MongoDB by passing list of “update_one” operations, but I am getting following error while doing the API call.

An unexpected error occurred! {:error=>#<Mongo::Error::NoServerAvailable: No server is available matching preference: #<Mongo::ServerSelector::Primary:0x2012 tag_sets=[] max_staleness=nil> using server_selection_timeout=30 and local_threshold=0.015>, :backtrace=>["/usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/mongo-2.4.3/lib/mongo/server_selector/selectable.rb:115:in select_server’", “/usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/mongo-2.4.3/lib/mongo/cluster.rb:231:in next_primary'", "/usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/mongo-2.4.3/lib/mongo/bulk_write.rb:58:in block in execute’”, “/usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/mongo-2.4.3/lib/mongo/retryable.rb:104:in write_with_retry'", "/usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/mongo-2.4.3/lib/mongo/bulk_write.rb:56:in execute’”, “/usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/mongo-2.4.3/lib/mongo/collection.rb:401:in bulk_write'", "/usr/share/logstash/vendor/local_gems/20d7ca77/logstash-output-mongodb-3.1.0/lib/logstash/outputs/mongodb.rb:73:in block in register’”, “org/jruby/RubyHash.java:1343:in each'", "/usr/share/logstash/vendor/local_gems/20d7ca77/logstash-output-mongodb-3.1.0/lib/logstash/outputs/mongodb.rb:65:in block in register’”, “org/jruby/ext/thread/Mutex.java:148:in synchronize'", "/usr/share/logstash/vendor/local_gems/20d7ca77/logstash-output-mongodb-3.1.0/lib/logstash/outputs/mongodb.rb:64:in block in register’”, “org/jruby/RubyKernel.java:1292:in loop'", "/usr/share/logstash/vendor/local_gems/20d7ca77/logstash-output-mongodb-3.1.0/lib/logstash/outputs/mongodb.rb:62:in block in register’”`

Can somebody help me figure out what could be the problem?

Please check this link
https://jira.mongodb.org/browse/MONGOID-4513