Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-2198

getlasterror works oddly with sharding

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major - P3 Major - P3
    • None
    • None
    • Sharding
    • None
    • ALL

    Description

      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"
      },

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: