Questions tagged [mongoid]

Mongoid is the official Ruby Object-Document-Mapper (ODM) for MongoDB.

Mongoid (pronounced mann-goyd) is an Object-Document-Mapper (ODM) for MongoDB written in Ruby. Mongoid as of version 5 is under the control and guidance of MongoDB as the official Ruby ODM.

The philosophy of Mongoid is to provide a familiar API to Ruby developers who have been using Active Record or Data Mapper, while leveraging the power of MongoDB's schema-less and performant document-based design, dynamic queries, and atomic modifier operations.

4728 questions
1
vote
1 answer

How to query all records that has an array attribute that contains specific set of elements in Mongoid?

Here is the setup. user has_many skills skills belongs_to user I would have to find out all users that have skills with ids 1,2 and 3 I can use intersection of three user collections. Skill.find(1).users & Skill.find(2).users & Skill.find(3).users…
benzhang
  • 471
  • 4
  • 11
1
vote
2 answers

How to force login, after facebook connect?

I'm using Rails, Devise, and Omniauth, and I'm trying to login using facebook connect. But after the facebook part, I'm being redirected to '/users/sign_in#=' in my application. According to the log (see the code), the user is persisted, so this…
HappyDeveloper
  • 12,480
  • 22
  • 82
  • 117
1
vote
1 answer

Play!/Morphia - Return MongoID as string (within json) / blobFieldsTracker Field

I'am relatively new to java and want to try out something new. At the moment I'am trying out the java framework play. What I'am trying to do is to rewrite a little REST JSON Api written in php as a play rest service. I'am using mongodb as…
Marc
  • 151
  • 1
  • 7
  • 16
1
vote
1 answer

Mongoid - Is it possible to embeds_one what the model is embedded_in?

Is it possible to have the following kind of relationship: User: class User include Mongoid::Document include Mongoid::Paperclip include Mongoid::Timestamps store_in :users belongs_to :team field :full_name, :type => String field…
larryzhao
  • 3,173
  • 2
  • 40
  • 62
1
vote
1 answer

Querying nested embedded documents with mongoid (or alternative)

I currently store a series of tweets as documents in mongodb the schema of which directly map to the json returned by the streaming API. The schema is very verbose with many nested embedded documents e.g. { "_id":…
Colm Troy
  • 1,947
  • 3
  • 22
  • 35
1
vote
1 answer

Auto assign variable names to mongodb document fields

I have a simple mongodb collection which stores tweets directly from the twitter api (via a ruby script). I'm now building a simple Sinatra app to display some of these tweets. So far, I've managed to get a simple view to display some of the tweet…
Colm Troy
  • 1,947
  • 3
  • 22
  • 35
1
vote
1 answer

Creating MongoDB composite indexes on multiple fields, with some overlap?

I'm new to MongoDB and trying to make sure I set up the proper indexes. I've seen similar questions about composite indexes here but none that exactly cover the situation I'm in. Note: I'm using Rails 3.2 and Mongoid. I have a collection of Events…
kaptron
  • 477
  • 5
  • 12
1
vote
1 answer

How to implement mongoid rails simple search

With rails 3.2, mongoid I don't want full-text search, I just wanna search one field of the model. E.g I have a "People" scaffold with just a name field. And I want to have a search form. For instance, I search "peter", if there's an exact…
The questioner
  • 724
  • 10
  • 21
1
vote
1 answer

Would properly using an index prevent so many queries?

I'm using MongoDB (with Mongoid) have a query which runs really really often in my app, I'm not sure I have proper indexes set up to make the queries more efficient, here is a snippet from my log when the query runs: MONGODB (33ms)…
JP Silvashy
  • 46,977
  • 48
  • 149
  • 227
1
vote
2 answers

Mongoid : saving the parent model does not save has_one instance

OK, just got: class User include Mongoid::Document # devise stuff... has_one :card end class Card include Mongoid::Document belongs_to :user end irb(main):012:0> user = User.new(email: "test@test.com", password:…
Nicolas Blanco
  • 11,164
  • 7
  • 38
  • 49
1
vote
1 answer

how can I query for unicode characters in mongodb using Ruby?

Let's say I have a record in my database that has: name: "World\u0092s Greatest Jet Fighter Pilot" OK I need to get in there and clean out the \u0092 (there were a ton of these in the db). I can query like this: # encoding: UTF-8 ... def…
jcollum
  • 43,623
  • 55
  • 191
  • 321
1
vote
1 answer

Mongoid and Full_text search issue

I have been working on rails project, which had been made using noSql(Mongoid). Every thing is running fine.The issue is I want to add.. full text search here also. I had been using this gems for this... gem 'mongoid_fulltext' and my model file…
user1232518
1
vote
1 answer

Anemone with Rails and MongoDB

I am preparing to write my first web crawler, and it looks like Anemone makes the most sense. There is built in support for MongoDB storage, and I am already using MongoDB via Mongoid in my Rails application. My goal is to store the crawled results,…
Micah Alcorn
  • 2,363
  • 2
  • 22
  • 45
1
vote
1 answer

Sort collection according to field in association

I'm having a trouble finding how to do a query with MongoDB/Mongoid here. So I have a model User, that has_many :scores, Score being another model that has a code and a value. The code is unique in the scope of the user. For a given code I want to…
ksol
  • 11,835
  • 5
  • 37
  • 64
1
vote
3 answers

mongoid rails mongodb data not cleaning up

Rails 3.2.1 app name: demo database: mongoDB with mongoid I have this scaffolding set up in rails 3.2.1: localhost:3000/pages, and I have these fields: title, content. I have already filled in 3 rows of data to each field. The problem is: after…
The questioner
  • 724
  • 10
  • 21
1 2 3
99
100