title: Call MongoDB Stored Javascript Function in C# .Net
body: <p>I need to call a MongoDB Stored JavaScript Function in C# Code.</p>
  
  <p>My Stored JavaScript Function <strong>GetUserInfo</strong></p>
  
  <pre><code>function() {
      return db.getCollection('Profession').find({});
  }
  </code></pre>
  
  <p>Execution :</p>
  
  <pre><code>db.loadServerScripts();
  
  GetUserInfo();
  </code></pre>
  
  <p>It returns the Collection with following documents (Here I pasted only 2 Documents, in real I'm having more than 10K Documents)</p>
  
  <pre><code>{
      "_id" : ObjectId("575845a713d284da0ac2ee81"),
      "Profession_id" : "575841b313d284da0ac2ee7d",
      "Prof_Name" : "Chief Officer"
  }
  
  {
      "_id" : ObjectId("575845d213d284da0ac2ee82"),
      "Profession_id" : "575841b313d284da0ac2ee7d",
      "Prof_Name" : "Executive Officer"
  }
  </code></pre>
  
  <p>In C#:</p>
  
  <pre><code>IMongoClient _client;
  IMongoDatabase _database;
  
  _client = new MongoClient();
  _database = _client.GetDatabase("SampleDB");
  </code></pre>
  
  <p>Kindly assist me how to call MongoDB Stored JavaScript Function in C# Code.</p>
  
  <p>The following Question uses <strong><code>Eval</code></strong>. In the latest driver, <strong>I can't able to find the Extended Function <code>_database.Eval</code></strong></p>
  
  <p><a href="https://stackoverflow.com/questions/23709351/calling-a-stored-procedure-in-mongodb-via-c-sharp">Calling a Stored Procedure in MongoDB via C#</a></p>
  
  <p>Kindly assist me...</p>