title: Getting general information about MongoDB collections with FSharp
body: <p>Can I retrieve basic information about all collections in a <code>MongoDB</code> with <code>F#</code>?</p>
  
  <p>I have a <code>MongoDB</code> with > 450 collections. I can access the db with </p>
  
  <pre><code>open MongoDB.Bson
  open MongoDB.Driver
  open MongoDB.Driver.Core 
  open MongoDB.FSharp
  open System.Collections.Generic
  
  let connectionString = "mystring"
  let client = new MongoClient(connectionString)
  let db = client.GetDatabase(name = "Production")
  </code></pre>
  
  <p>I had considered trying to just get all collections then loop through each collection name and get basic information about each collection with </p>
  
  <pre><code>let collections = db.ListCollections()
  </code></pre>
  
  <p>and </p>
  
  <pre><code>db.GetCollection([name of a collection])
  </code></pre>
  
  <p>but the <code>db.GetCollection([name])</code> requires me to define a type to pull the information about each collection. This is challenging for me as I don't want to have to define a type for each collection, of which there are > 450, and frankly, I don't really know much about this DB. (Actually, no one in my org does; that's why I'm trying to put together a <em>very basic</em> data dictionary.)</p>
  
  <p>Is defining the type for each collection really necessary? Can I use the <a href="http://api.mongodb.com/csharp/current/html/Methods_T_MongoDB_Driver_MongoCollection.htm" rel="noreferrer">MongoCollection methods available here</a> without having to define a type for each collection?</p>
  
  <hr>
  
  <p><strong>EDIT</strong>: Ultimately, I'd like to be able to output collection name, the <em>n</em> documents in each collection, a list of the field names in each collection, and a list of each field type.</p>