ProjectionDefinition.Expression does not create correct mongo statement

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Duplicate
    • Priority: Major - P3
    • None
    • Affects Version/s: 2.4.4
    • Component/s: Serialization
    • None
    • Environment:
      Windows 10, .net standard 2 project
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      When you have a nested object where there are 2 properties such that the name of the first property starts with the name of the second property.
      ```
      public class SubscriberSource
      {
      /// ...
      public DateTime? StatusChangeDate

      { get; set; }
      public SubscriberStatus Status { get; set; }

      }
      ```
      And you try to build a projection, it will not generate anything for the projection at all. There is probably somewhere in the code that a .startsWith is utilized to add fields to the projection builder for some reason.

      So when i write something like
      ```
      _collection.Find(query).Project(x => new

      { x.StatusChangeDate, x.Status }

      )
      ```
      No projection is passed to mongoDb at all and all fields are returned.

              Assignee:
              Unassigned
              Reporter:
              Vadim Rybak
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: