node.js mongodb query was working fine until replica set setup and result is null -


i have followed mongo documentation @ http://docs.mongodb.org/manual/tutorial/deploy-replica-set-for-testing/ setup replica set (3 instances only) in local windows machine. tested followings , works fine:

  1. inserted data , connect primary using robomongo , can see data
  2. stop primary , 1 of secondary take on primary , data there.
  3. brought the 1 stopped , secondary now.

my problems:

  1. when use robomongo connect of secondary can't see data although there.
  2. my query code below return null although there data in mongodb

the connection string (no authentication needed)

mongodb://mark2:27017,mark2:27018,mark2:27019/mydb?w=0&readpreference=secondary&replset=rs0

i rs.status() , shows 3 nodes active.

{         "_id" : "rs0",         "version" : 3,         "members" : [                 {                         "_id" : 0,                         "host" : "mark2:27017"                 },                 {                         "_id" : 1,                         "host" : "mark2:27018"                 },                 {                         "_id" : 2,                         "host" : "mark2:27019"                 }         ] } 

the query simple query

db.collection("user").findone({email:"yummy@gmail.com"}, function(err, result) {         if(result) { // result null wasn't before setting replica set          } else {          }  }); 

appreciate advice please. !

cheerio, mark thien

i sorry terrible fault. put in world database name.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -