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

  • Home
  • SEARCH
  • 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 6988221
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:02:52+00:00 2026-05-27T19:02:52+00:00

I am using mongo db for a model in my rails application, and when

  • 0

I am using mongo db for a model in my rails application, and when I execute

Model.where(:$or => [{:field1 => true}, {:field2 => true}])

produces plucky query

#<Plucky::Query $or: [{:field1=>true}, {:field2=>true}], transformer: #<Proc:0xa4b1c5c@/home/x/.rvm/gems/ruby-1.9.2-p290@app/gems/mongo_mapper-0.9.2/lib/mongo_mapper/plugins/querying.rb:79 (lambda)>>

performs OR operation and fetches the correct results, ie, field1 or field2 is true but

Model.where(:$and => [{:field1 => true}, {:field2 => true}])

produces plucky query

#<Plucky::Query $and: {"$in"=>[{:field1=>true}, {:field2=>true}]}, transformer: #<Proc:0xa435120@/home/x/.rvm/gems/ruby-1.9.2-p290@app/gems/mongo_mapper-0.9.2/lib/mongo_mapper/plugins/querying.rb:79 (lambda)>>

doesn’t perform the AND operation, instead it throws error

Mongo::OperationFailure Exception: $and expression must be a nonempty
array

DETAILS

Rails version: 3.1,
Mongo version: 2.0.0,
mongo_mapper gem version: 0.9.2

  • 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-27T19:02:53+00:00Added an answer on May 27, 2026 at 7:02 pm

    You will need to upgrade MongoMapper. $and support was added in plucky 0.4.x, which MongoMapper uses as of version 0.10.1.

    This commit added $and support to plucky and is part of plucky 0.4.2 and greater.

    This commit updated MongoMapper to use plucky 0.4.x and is part of MM 0.10.1 and greater.

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

Sidebar

Related Questions

I've got a Rails 3.0 project, using mongo with MongoMapper. I've got a model
I have been using mysql in a new rails application, but now I wanted
I'm trying to implement a WPF application using MVVM (Model-View-ViewModel) pattern and I'd like
Currently, I am using Rails with Mysql as the backend. Unfortunately, my application has
How can I have one mongo model go to one database and another using
I was currently developing a desktop application in C# using mono and testing in
I am using mongo db and I got one weird problem when calling to_json
I'm trying to save a record with JsonObjectField (using lift-mongo- record in Play framework)
I am using Mongodb Java driver for my Java client application. it needs to
I've got a Rails 3 app (using Mongodb and Mongoid if that makes a

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.