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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T06:32:51+00:00 2026-05-20T06:32:51+00:00

I have not clearly issue during query using two criterials like Id and Other.

  • 0

I have not clearly issue during query using two criterials like Id and Other. I use a Repository storing some data like id,iso,value. I have created an index(“_id”,”Iso”) to performs queries but queries are only returning my cursor if i use only one criterial like _id, but is returning nothing if a use two (_id, Iso) (commented code).
Are the index affecting the response or the query method are failing?
use :v1.6.5 and C# official.

Sample.

//Getting Data
public List<BsonObject> Get_object(string ID, string Iso)
{
    using (var helper = BsonHelper.Create())
    {
        //helper.Db.Repository.EnsureIndex("_Id","Iso");
        var query = Query.EQ("_Id", ID);
        //if (!String.IsNullOrEmpty(Iso))
        //    query = Query.And(query, Query.EQ("Iso", Iso));
        var cursor = helper.Db.Repository.FindAs<BsonObject>(query);
        return cursor.ToList();
    }
}

Data:

{  
    "_id": "2345019",  
    "Iso": "UK",  
    "Data": "Some data"  
}

After that I have Updated my data using Update.Set() methods. I can see the changed data using MongoView. The new data are correct but the query is always returning the sames olds values. To see these values i use a page that can eventually cached, but if add a timestamp at end are not changing anything, page is always returning the same olds data. Your comments are welcome, 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-20T06:32:52+00:00Added an answer on May 20, 2026 at 6:32 am

    I do not recall offhand how the C# driver creates indexes, but the shell command for creating an index is like this:

    db.things.ensureIndex({j:1});
    

    Notice the ‘1’ which is like saying ‘true’.

    In your code, you have:

    helper.Db.Repository.EnsureIndex("_Id","Iso");
    

    Perhaps it should be:

    helper.Db.Repository.EnsureIndex("_Id", 1);
    helper.Db.Repository.EnsureIndex("Iso", 1);
    

    It could also be related to the fact that you are creating indexes on “_Id” and the actual id field is called “_id” … MongoDB is case sensitive.

    Have a quick look through the index documentation: http://www.mongodb.org/display/DOCS/Indexes

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

Sidebar

Related Questions

I clearly do not understand jQuery asynchronous execution properly. I have the following issue.
EDIT: Apparently the question is not clearly formulated enough. The issue I am having
I have a query that contains about 10 joins. Using a List View and
Ok I have a complex issue. I will try to explain clearly. I am
have not tested on windows. but in ubuntu when u disconnect from the network,
I have not used generics much and so cannot figure out if it is
I have not seen much support for Grails to develop facebook apps.I was just
I have not had to mess with mailto links much. However I now need
I have not been able to find a way to cancel/terminate asynchronous read operation
I have not used Windows Vista. I knew that many APIs have been changed/deprecated

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.