Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-128

find(..) query with MongoServer.Create("...?slaveok=true") will always throw "not master"

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 0.11
    • Affects Version/s: 0.9
    • Component/s: None
    • None
    • Environment:
      Windows 7 C# .net 3.5 driver version 10gen driver v0.9.
      MongoDB server for linux version 1.6.3 running in a 2 nodes replica set with 2 arbiters (all running on centOS 5.5 VM)

      //begin code
      var m = MongoServer.Create("mongodb://192.168.1.110:27117,192.168.1.112:27117/cache?replicaset=cacheset&slaveok=true");

      var col = m["cache"]["flatdoc"];
      var q = Query.In("_id", BsonArray.Create(new[]

      { 1,2,3 }

      ));

      //this will throw: not master
      var res = (from d in col.Find(q) select d).ToList();

      //this will also throw: not master
      res = (from d in col.Find(q).SetFlags(QueryFlags.SlaveOk) select d).ToList();

      //end code
      /*
      The only way for this to not throw is to exclude slaveok=true from mongo url and
      calling SetFlags(QueryFlags.SlaveOk) on the cursor before use.

      I hope this helps
      */

            Assignee:
            robert@mongodb.com Robert Stam
            Reporter:
            hnguye8 huy nguyen
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: