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

Error in MongoDB.Bson.BsonReader.ReadElementType(Int32 typeNumber) when reading type Timestamp

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Critical - P2 Critical - P2
    • None
    • None
    • None
    • None

    Description

      The method ReadElementType does not handle BsonType.Timestamp.

      This issue shows ups when the mongodb server is running in replication mode and the driver queries the GetLastError from the DB after performing a save/update operation.
      The server responds (with the result as per the spec for OP_REPLY http://www.mongodb.org/display/DOCS/Mongo+Wire+Protocol#MongoWireProtocol-OPREPLY) with 1 document

      The hex dump for the BSON document is

      3F-00-00-00-0A-65-72-72-00-08-75-70-64-61-74-65-64-45-78-69-73-74-69-6E-67-00-01-10-6E-00-01-00-00-00-11-6C-61-73-74-4F-70-00-01-00-00-00-84-2F-81-4C-01-6F-6B-00-00-00-00-00-00-00-F0-3F-00

      which when translate to JSON should look like
      {
      "err" : null,
      "updatedExisting" : true,
      "n" : 1,
      "lastOp" :

      { "t" : 1283534737000, "i" : 1 }

      ,
      "ok" : 1
      }

      But the BsonReader throws an ArgumentOutOfRangeException exception.

      Adding (case BsonType.Timestamp at line 143 in the file samus-mongodb-csharp-85d3524\source\MongoDB\Bson\BsonReader.cs would solve the issue.

      Thanks,
      Saleem

      Attachments

        Activity

          People

            lanwin Steve Wagner
            saleem Syed Saleem Javid Brahmanapalli
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: