Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6872959
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:59:44+00:00 2026-05-27T03:59:44+00:00

I am new to mongodb/mongomapper and can’t find an answer to this. I have

  • 0

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 working.
Unfortunately I don’t know which version of mongodb and mongomapper I was using before.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T03:59:44+00:00Added an answer on May 27, 2026 at 3:59 am

    In the current versions of MongoMapper, this will work:

    MessageThread.where(:partecipant_ids => 15)
    

    And this should work as well…

    MessageThread.where(:partecipant_ids => [15])
    

    …because plucky autoexpands that to:

    MessageThread.where(:partecipant_ids => { :$in => [15] })
    

    (see https://github.com/jnunemaker/plucky/blob/master/lib/plucky/criteria_hash.rb#L121)

    I’d say take a look at your data and try out queries in the Mongo console to make sure you have a working query. MongoDB queries translate directly to MM queries except for the above (and a few other minor) caveats. See http://www.mongodb.org/display/DOCS/Querying

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to MongoDb and I have following question: class Venue { String name
I have the following code to connect to MongoDB: try { $m = new
I'm new in mongodb and can't find the solution. I'm using mongo-php-driver I just
So i'm new with mongodb and mapreduce in general and came across this "quirk"
I'm new to MongoDB and trying out some fundamentals, but this astonished me. I'm
I am making a new application in MongoDB, and I have found that the
I've got a simple model object: class UserRating include MongoMapper::EmbeddedDocument key :idea_id, ObjectId key
I'm new to rails and mongodb, and have a simple form attempting to create
I'm new to Rails development and I'm starting with MongoDB also. I have been
I'm new to MongoDB. Just wondering: How do I convert this shell command to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.