Uploaded image for project: 'Entity Framework'
  1. Entity Framework
  2. EF-184

Allow CreateIndex partial filters strong typing

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • None
    • Dotnet Drivers

      When using CreateIndex users are forced to use CreateIndex<BsonDocument> and then specify their partial filters using the bson syntax such as:

       

      mb.Entity<Customer()
        .HasIndex(a => a.PostCode)
        .HasCreateIndexOptions(new CreateIndexOptions<BsonDocument>(
           PartialFilterExpression = Builders<BsonDocument>.Filter.Eq(a => a["Country"], "UK"));

      Ideally they would be able to specify it using the correct type not BsonDocument to allow us to use EF's element name mapping and compile-time checking.

      Reported on the forums at https://www.mongodb.com/community/forums/t/ef-provider-support-for-hasindex-on-nested-objects/310463/5

            Assignee:
            Unassigned Unassigned
            Reporter:
            damien.guard@mongodb.com Damien Guard
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: