MongoDB C# offic. List<BsonObject> query issue and always olds values? -


i have not issue during query using 2 criterials id , other. use repository storing data id,iso,value. have created index("_id","iso") performs queries queries returning cursor if use 1 criterial _id, returning nothing if use 2 (_id, iso) (commented code).
index affecting response or query method failing?
use :v1.6.5 , 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 have updated data using update.set() methods. can see changed data using mongoview. new data correct query returning sames olds values. see these values use page can cached, if add timestamp @ end not changing anything, page returning same olds data. comments welcome, thanks.

i not recall offhand how c# driver creates indexes, shell command creating index this:

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

notice '1' saying 'true'.

in code, have:

helper.db.repository.ensureindex("_id","iso"); 

perhaps should be:

helper.db.repository.ensureindex("_id", 1); helper.db.repository.ensureindex("iso", 1); 

it related fact creating indexes on "_id" , actual id field called "_id" ... mongodb case sensitive.

have quick through index documentation: http://www.mongodb.org/display/docs/indexes


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -