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

Positional operator not working when running inside Docker container

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 2.9.0
    • Affects Version/s: 2.4.4
    • Component/s: Read Operations
    • None

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

      Unable to find source-code formatter for language: csharp. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      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.

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

              Created:
              Updated:
              Resolved: