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

Using maxTime() on MongoDB 3.4 and 3.6 does not yield the same error code

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • 3.6.0, 3.6.3
    • 3.6.4, 3.7.4
    • Querying
    • None
    • Fully Compatible
    • v3.6
    • Hide

      use test
      db.test.insert({a: 1})
      db.test.find({$where: "sleep(101)"}).maxTimeMS(100)
      

      Show
      use test db.test.insert({a: 1}) db.test.find({$where: "sleep(101)"}).maxTimeMS(100)
    • Query 2018-03-12, Query 2018-03-26

    Description

      Using maxTime() does not yield the same exception when accessing a MongoDB deployment. It seems that timeouts now throw an error code 96 instead of 50 in recent versions of the MongoDB server.

      In the Java driver it makes the driver throw a MongoQueryException instead of a MongoExecutionTimeoutException.

      Sample Java code:

      MongoDatabase db = (new MongoClient()).getDatabase("foo");
      MongoCollection<Document> coll = db.getCollection("bar");
      coll.insertOne(new Document());
      coll.find(Filters.eq("$where", "sleep(100)")).maxTime(100, TimeUnit.MILLISECONDS).first();
      

      Attachments

        Issue Links

          Activity

            People

              charlie.swanson@mongodb.com Charlie Swanson
              charles.sarrazin@mongodb.com Charles Sarrazin (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: