title: MongoDB/C# get all values of a certain key in all documents
body: <p>I have a MongoDB collection called "employees" where there are documents like this:</p>
  
  <pre><code>{ 
    "_id": "4dc077b07701540f34000001", 
    "FullName": "Fullname...", 
    "FirstName": "First name...", 
    "LastName": "Last name...", 
    "Title": "Title... ",
    "Location": "Location...", 
    "Customer": "Customer...", 
    "Phone": "Phone...", 
    "CellPhone" : "Cellphone...", 
    "EMail": "E-mail..." 
  }
  </code></pre>
  
  <p>I am trying to make a method that does a foreach loop on all documents in the collection and puts each value of the FullName-key and adds it to a List.</p>
  
  <pre><code>        List&lt;string&gt; listed = new List&lt;string&gt;();
          IMongoCollection collection = _db.GetCollection("employees");
          //var list = collection.FindAll().Documents.ToList();
          var persons = from p in collection.AsQueryable()
                        select p["FullName"];
          //foreach (var lt in list)
          foreach (var name in persons)
          {
              //listed.Add(lt["FullName"].ToString());
              listed.Add(name.ToString());
          }
          return listed;
  </code></pre>
  
  <p>Above is the code I have tried, the commented-code returns a NullReferenceException, the uncommented code returns the whole document in a list.</p>
  
  <p>My question is: What kind of query must I do to get each value for every key called "FullName" into a list? I am using the current MongoDB stable version on Windows 7, and I am using the MongoDB-CSharp community driver. All help and pointers are appreciated!</p>