top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

maxTimeMS() with MongoDB

0 votes
386 views

Mongodb 3 provides the maxTimeMS() option. Is it possible to apply this through the Ruby Driver 2.2 and Mongoid 5?

posted Jun 14, 2016 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

Currently, Mongoid does not support the option but you can use the driver directly and pass the option, :max_time_ms, to the relevant methods or call it as a method on a view:

Model.collection.find({}, max_time_ms: 200)
Model.collection.find.max_time_ms(200)

This ticket is tracking the addition of the option in Mongoid 6: https://jira.mongodb.org/browse/MONGOID-4012

answer Jun 14, 2016 by Sheetal Chauhan
Similar Questions
+1 vote

We recently looked at mongoDB a bit. I was discussing using mongoDB with active record but was told that maybe there are other or better options. Can someone comment on that ?

Also, someone suggested storing a ruby array directly inside of a record where I would have opted for the array to be a separate set of records in active record using has_many and belongs_to .. It seemed to me that how I search on those child records would be a big factor but I soon realized I need to find out what are the options. Do people store arrays and hashes directly in mongo DB fields or is that not the best way to go ?

+2 votes

I'd like to continue with Rails but I wonder how to switch from SQLite3 to MongoDB.

+1 vote

I am new to ruby on rails (using rails 4 and ruby 2.0.0) and I'm looking for a good tutorial for mongo db using mongoid.yml.

I found a few online, but they give only the basic steps. And I have done till that. ie. insert, query, etc from a mongo db database through the controller.

My basic question revolves around making a connection pool and using it. What changes to do it the mongoid.yml and how to (in java terms) getConnection from the controller???

Any help would be appreciated?

...