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

$project or $group does not support <document>

    • Type: Icon: Improvement Improvement
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.4
    • Component/s: Linq
    • Environment:
      windows 10, asp.net core

      Originally on SO.

      I'm trying to run aggregate with projection but i get NotSupportedException: $project or $group does not support <document>. I am running version 2.4.4 of driver with mongodb v3.4.

      Unable to find source-code formatter for language: csharp. 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 filter = Builders<T>.Filter.Regex(x=>x.Value,"/test/gi");
      
      var aggregate = collection.Aggregate()
             .Match(filter)
             .Project(x => new 
             {
                Idx = x.Value.IndexOf("test"),
                Result = x
             }
             .SortBy(x => x.Idx);
      

      I thought IndexOfCP is supported.

      What am i doing wrong here?

            Assignee:
            wan.bachtiar@mongodb.com Wan Bachtiar
            Reporter:
            rm2k rethabile
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: