getlasterror works oddly with sharding

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Duplicate
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Sharding
    • None
    • Environment:
    • ALL
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      The PHP remove() method set with safe => true is returning instantly and not outputting any count for the removed docs even though I can see the remove op in db.currentOp()

      try
      {
      $DBMongoConn = new Mongo($config['database']['mongodb']['server']);
      }
      catch (Exception $e)
      {
      throw new Exception('MongoDB Error: connection failed: ' . $e->getMessage());
      }

      $collection = $sdDb->selectCollection('metrics');

      try
      {
      $result = $collection->remove(array('accId' => $account['accountId'], 'tA' => array('$lte' => $deleteTime)), array('safe' => true));
      }
      catch (Exception $e)
      {
      die('Query failed (' . _LINE_ . '): ' . $e->getMessage() . "\n");
      }

      $error = $sdDb->lastError();

      $account['accountId'] = int
      $deleteTime = MongoDate

      $error['err'] is null
      $result['n'] is 0

      db.currentOp()

      {
      "opid" : "shard1:418732718",
      "active" : true,
      "lockType" : "write",
      "waitingForLock" : false,
      "secs_running" : 124,
      "op" : "remove",
      "ns" : "sd.processes",
      "query" : {
      "accId" : 1,
      "tA" :

      { "$lte" : ISODate("2010-12-02T09:16:15Z") }

      },
      "client" : "10.121.12.228:33739",
      "desc" : "conn"
      },

            Assignee:
            Kristina Chodorow (Inactive)
            Reporter:
            David Mytton
            Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: