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 4610750
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T01:10:31+00:00 2026-05-22T01:10:31+00:00

The query Mongoid is executing does not make sense to me, and I think

  • 0

The query Mongoid is executing does not make sense to me, and I think I must be defining a couple of things wrong.

But I do not know what the problem is

==Model Definition==
User
  references_many :questions_about, :class_name=>"Question", :inverse_of => :about_user

Question
  references_in :about_user, :class_name=>"User",:inverse_of => :questions_about

Console:

u=User.find("nazroll")
u.questions_about.map
db['questions'].find({"user_id"=>#010b}, {})

The correct query that should have been executed should be

db['questions'].find({"ABOUT_user_id"=>#010b}, {})

This is because I am defining the inverse of the :questions_about as :about_user

Any help rendered is greatly appreciated – tearing my head out. Thanks!

  • 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-22T01:10:32+00:00Added an answer on May 22, 2026 at 1:10 am

    Ok, it was actually because i was using an older version of mongoid, which was actually seriously buggy.

    Upgrade to the latest version and all is fine

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

Sidebar

Related Questions

I want to query on a Hash field for a Mongoid Class. I'm not
The following query does not work and it keeps giving a weird error: keys
I can't seem to find anything to make a date range query using Mongoid/Rails.
Query was this: CREATE TABLE `query` ( `id` int(11) NOT NULL auto_increment, `searchquery` varchar(255)
Query 1 works but query 2 doesn't: Query #1: SELECT * FROM `users` WHERE
Query always return -1 don't know why. Will someone please explain. Value of count
Query below works fine when user selects different dates but when user selects same
I'm trying to execute a more or less advanced query with Mongoid that basically
I`m having a problem with search query in Rails 3 application using Mongoid. My
I use MongoDB in my rails application with Mongoid mapper. But I don't understand

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.