mongomapper

Mongo Java drivers & mappers performances

一笑奈何 提交于 2019-12-07 08:38:39
问题 Mongo in Java can be used with several tools: the 10gen official driver an alternative async Java driver a mapper — a library built on top of a driver — Morphia, Jongo... ( see complete list ) Is there some benchmarks comparing mappers to drivers performances and one versus each others? 回答1: Unfortunately, there are no benchmarks that I am aware of. The driver home page is here (but I'm guessing that you probably know that) and the Java Language Center containing all information related to

How can I get mongo mapper to generate the config/mongo.yml file in Rails 4

让人想犯罪 __ 提交于 2019-12-07 03:27:30
问题 I am trying to make a rails app using the Mongo Mapper gem. I am following the instructions in the Mongo Mapper Documentation. Here is the link: Mongo Mapper Docs First, I generated a new rails 4 app excluding activerecord. rails new my_app --skip-active-record In the next step I added the gem 'mongo_mapper' and gem 'bson_ext' and then bundled. The next step is generating the config/mongo.yml file. When I try to run the command: script/rails generate mongo_mapper:config I get this error:

MongoMapper and more than one databases in application

拈花ヽ惹草 提交于 2019-12-06 16:30:53
Is it possible to use MongoMapper in application that stores its models in many databases? For example I have separated database for Users and another one for Orders and I want to model both User and Order using MongoMapper. Of course I can switch MongoMapper.connection attribute but it is potentially unsafe due to race condition. You can set the connection per model: User.connection(Mongo::Connection.new('localhost', 27017)) 来源: https://stackoverflow.com/questions/6751568/mongomapper-and-more-than-one-databases-in-application

Rails 3 Polymorphic Association between one MongoMapper model and one/many Active Record model/s

你说的曾经没有我的故事 提交于 2019-12-06 16:24:11
I have a Record model (Active Record) that stores some custom logs. Record is in polymorphic association with all the other model in my app, and I can effectively log what I want hooking my Record methods in the other controllers. What I need: To have the logs in a separate database. So I have to: Be able to manage two different databases in my apllication (one is Postgres/ActiveRecord and the other one is MongoDB/MongoMapper) Generate a polymorphic association between my Record model, now with MongoMapper, and the rest of my Active Record models. That way I can persist my logs to the MongoDB

Advice on migrating from MongoMapper to Mongoid?

瘦欲@ 提交于 2019-12-05 18:56:35
问题 It seems like Mongoid is now the superior ORM for Mongo based on performance and development activity. Unfortunately, we're on MongoMapper and need to migrate. Are there any concerns or stumbling blocks we should be aware of? We have found a few outdated articles on Google and tried posting on the Mongoid Google Groups (though we were prohibited), but would love thoughts from SO members who have done this in the past. We're on Rails 3.2.12. Thanks! 回答1: Both of them are great MongoDB

Mongo_mapper limit results

牧云@^-^@ 提交于 2019-12-05 18:24:17
I have a query like this: @allJobs = Job.where(:merchant_id => session[:admin_id].to_s).sort(:start_date.desc).limit(100) When I run .count on this I get: jobs count 1720 I expect to see : jobs count 100 What am I doing wrong? If I try to run Job.all(query).limit(100) I get "undefined method limit for Array #foo" It seems there is no way I can get the results to restrict to 100 records sorted in descending order by start_date! UPDATE: I cannot even do something simple like this: @allJobs = Job.limit(100) Rails.logger.info("@allJobs count is " + @allJobs.count.to_s) Console: @allJobs count is

“LIKE” command in MongoDB(mongomapper)

与世无争的帅哥 提交于 2019-12-05 16:01:46
how to use filter data as sql do "LIKE" in MongoDB, instead I using gem mongomapper on my rails apps? .thanks If you're looking for partial matches on a string you can query with a regular expression. Here's the relevant part of the mongomapper docs: http://api.mongodb.org/ruby/current/file.TUTORIAL.html#Querying_with_Regular_Expressions Worth noting this from the Mongodb docs: "For simple prefix queries (also called rooted regexps) like /^prefix/, the database will use an index when available and appropriate (much like most SQL databases that use indexes for a LIKE 'prefix%' expression). This

Find documents including element in Array field with mongomapper?

半世苍凉 提交于 2019-12-05 13:32:04
I am new to mongodb/mongomapper and can't find an answer to this. I have a mongomapper class with the following fields key :author_id, Integer key :partecipant_ids, Array Let's say I have a "record" with the following attributes: { :author_id => 10, :partecipant_ids => [10,15,201] } I want to retrieve all the objects where the partecipant with id 15 is involved. I did not find any mention in the documentation. The strange thing is that previously I was doing this query MessageThread.where :partecipant_ids => [15] which worked, but after (maybe) some change in the gem/mongodb version it stopped

How to write a Devise extension (to use a custom datastore)

夙愿已清 提交于 2019-12-05 13:07:34
问题 I'd like to write an extension for Devise that allows you to use parse_resource as the datastore (as opposed to ActiveRecord). parse_resource is a Ruby wrapper for Parse.com's REST api. It's interface is pretty much the same as ActiveRecord's and is ActiveModel complaint. Because of this, it seems possible that an extension for Devise may not require too much non-boilerplate. However, I can't find any tutorials. All I have to rely on are the sources for other extensions. From the MongoMapper

Mongo Java drivers & mappers performances

天大地大妈咪最大 提交于 2019-12-05 13:05:11
Mongo in Java can be used with several tools: the 10gen official driver an alternative async Java driver a mapper — a library built on top of a driver — Morphia , Jongo ... ( see complete list ) Is there some benchmarks comparing mappers to drivers performances and one versus each others? Unfortunately, there are no benchmarks that I am aware of. The driver home page is here (but I'm guessing that you probably know that) and the Java Language Center containing all information related to Java for MongoDB. There is quite a bit of work going on with the Java drivers at present afaik but no