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

DOCS: Case insensative string serialization in .NET driver

    • Type: Icon: Improvement Improvement
    • Resolution: Won't Fix
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 1.8.2
    • Component/s: Serialization
    • Labels:
      None
    • Environment:
      C# Driver
    • Fully Compatible

      I would like an attribute which controls string serialization to / from Mongo at the C# layer. Something like

      [BsonStringOptions(UseLowerCase = true)]

      The motivation: Here's some feedback from a new app I'm working on in C#.

      We are coming from SQL Server where most string comparisons are case insensitive. Obviously MongoDB is case sensitive.

      There are plenty of fields we want to continue case insensitive comps on. For example, usernames, emails, urls, etc. We are fine to just store them all lowercase. But having the serialization engine help ensure this would help.

      It would be great if there was an attribute that would help with this (kind of like [BsonDateTimeOptions(Kind = DateTimeKind.Local)] for UTC vs Local time).

      So I'd like to offer a new feature idea:

      class Model {
      [BsonStringOptions(UseLowerCase = true)]
      public string Username

      {get; set;}

      }

      Where when this object is saved, it automatically converts to lowercase. I can do this in code, but it's a pain and potentially error prone.

            Assignee:
            Unassigned Unassigned
            Reporter:
            mkennedy66996693 Michael Kennedy
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: