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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T04:56:44+00:00 2026-05-20T04:56:44+00:00

I am using mongoDB database. in which I have collection in below format. {

  • 0

I am using mongoDB database. in which I have collection in below format.

{ name : name1 , area: a , country : c}
{ name : name2 , area: b , country : c}
{ name : name3 , area: a1 , country : c1}
{ name : name4 , area: b1 , country : c1}

i want query like

select * from coll where (country =c and area =a) or (country = c1 and area = b1)

in mongodb query.

I have read many document but not found suitable answer.

So if any one knows please reply.

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-20T04:56:44+00:00Added an answer on May 20, 2026 at 4:56 am

    By default, all elements in a mongodb query use the and operator. You can specify an or operator using the { "$or": [ ... ] } construct, as described in the documentation.

    Your query will be :

    { "$or": [ { "country": "c", "area": "a" }, { "country": "c1", "area": "b1" } ] }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is the first project by me which is using MongoDB. I have hosted
In a MongoDB database, I have a collection of items, and each item stores
I'm building a Route Planner Webapp using Spring/Hibernate/Tomcat and a mysql database, I have
I'm using mongodb and I store datetime in my database in this way for
I'm using Python in conjunction with MongoDB. I have an array of words, and
Suppose I have ten cron jobs running in parallel which fetch entries from database
I have a mongodb connection making class which I cannot modify for some reason.
I have just installed MongoDB in my machine (Windows 7) and installed node-mongodb-native using
I'm trying to map an existing mongodb database to domain objects using datanuclues (3.0.0-m6)
I currently have a MongoDB setup with a fairly large database (about 250m documents).

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.