Allow default values for CLR objects when missing in document

XMLWordPrintableJSON

    • Type: New Feature
    • Resolution: Unresolved
    • Priority: Unknown
    • None
    • Affects Version/s: None
    • None
    • None
    • Dotnet Drivers
    • None
    • None
    • None
    • None
    • None
    • None

      Recommended API would be:

      mb.Entity<Movie>().Property(p => p.Rating).HasDefaultValueWhenMissing("N/A")

      Should also:

      • Have an overload with no parameter to use CLR type default, e.g. 0 for numeric
      • Identity and honor [BsonDefaultValueAttribute] on the property

      Open considerations:

      • Whether to support this for owned navigation properties

            Assignee:
            Damien Guard
            Reporter:
            Damien Guard
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: