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

SelectMany LINQ operator not supported

    • Type: Icon: New Feature New Feature
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 2.1
    • Affects Version/s: 1.6
    • Component/s: Linq
    • None
    • Environment:
      windows 2k8 r2, using mongodb version 2.0.6 64-bit, using driver 1.6

      Lets say i have this simplified version of my task workflow:
      public class TaskGraph
      {
      [BsonId]
      public BsonObjectId Id

      { get; set; }
      public List<Task> Tasks { get; set; }

      }

      public class Task
      {
      [BsonId]
      public Guid Id

      { get; set; }
      public string AssignedTo { get; set; }

      // other stuff elided
      }

      In this case, the following query (where I'm trying to get all tasks assigned to me regardless of which workflow they are a part of):

      var db = DBUtils.GetMongoDB("taskpoc");
      var queryCtx = db.GetCollection<TaskGraph>("TaskGraphs").AsQueryable();
      var tasksAssignedToMe = queryCtx
      .SelectMany(tg => tg.Tasks)
      .Where(t => t.AssignedTo == "tkrick");

      ... throws the following exception:
      System.NotSupportedException

      {"The SelectMany query operator is not supported."}

      This feature is to enable this to return those results.

            Assignee:
            craig.wilson@mongodb.com Craig Wilson
            Reporter:
            tkrick Travis Krick
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: