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

Positional operator not working when running inside Docker container

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major - P3 Major - P3
    • 2.9.0
    • 2.4.4
    • Read Operations
    • None

    Description

      This code works great when I run it in a standard .NET Core console app:

      collection.UpdateOne(
          filter: Builders<Animal>.Filter.Where(x => x.Subdocument.Subarray.Any(itm => itm.SomeProperty == "foobar")),
          update: Builders<Animal>.Update.Inc(x => x.Subdocument.Subarray[-1].SomeNumericProperty, 10)
      );
      

      But when I run that same console app in a Linux container on my Windows machine, I get this exception:

      MongoBulkWriteException`1: A bulk write operation resulted in one or more errors.
      cannot use the part (Subarray of Subdocument.Subarray.−1.SomeNumericProperty) to traverse the element ({Subarray: [ /* All elements of Subarray listed here */ ]})
      MongoDB.Driver.MongoCollectionImpl+<BulkWriteAsync>d__22.MoveNext()
       
      MongoWriteException: A write operation resulted in an error.
      cannot use the part (Subarray of Order.Subarray.−1.SomeNumericProperty) to traverse the element ({Items: [ /* All elements of Subarray listed here */ ]})
      

      I've tried with simpler update expressions, like just set a property without any positional operator, and that works, so my conclusion is that it has something to do with the positional operator.

      Attachments

        Activity

          People

            dmitry.lukyanov@mongodb.com Dmitry Lukyanov (Inactive)
            johnknoop John Knoop
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: