Translate String.Replace

XMLWordPrintableJSON

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

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?
    • None
    • None
    • None
    • None
    • None
    • None

      Found with EF Core spec tests. See EF-223

      C# driver repro:

      Unable to find source-code formatter for language: c3. 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
      var client = new MongoClient("mongodb://localhost:27017");
      var database = client.GetDatabase("db224");
      database.DropCollection("customers");
      
      var collection = database.GetCollection<Customer>("customers");
      collection.InsertMany([
          new() { Id = 1, City = "London", Country = "UK" },
          new() { Id = 2, City = "London", Country = "USA" },
          new() { Id = 3, City = "Seattle", Country = "UK" },
          new() { Id = 4, City = "Seattle", Country = "USA" }
      ]);
      
      var results = collection.AsQueryable()
          .Where(c => c.City.Replace("tt", "zz") == "Seazzle")
          .ToList();
      
      foreach (var result in results)
      {
          Console.WriteLine($"Found {result} {result.City} {result.Country}");
      }
      
      var results2 = collection.AsQueryable()
          .Select(c => c.City.Replace("tt", "zz"))
          .ToList();
      
      foreach (var result in results2)
      {
          Console.WriteLine($"Found {result}");
      }
      
      public class Customer
      {
          public int Id { get; set; }
          public string City { get; set; }
          public string Country { get; set; }
      }
      

              Assignee:
              Unassigned
              Reporter:
              Arthur Vickers
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated: