title: How to get schema from existing collection MongoDB
body: <p>I have database &quot;Data&quot;, collection &quot;licence&quot; and collection is full of data. How can I get schema from collection and print to console? Without using Mongoose. Thank you</p>
  <pre><code>MongoClient.connect(url, function(err, db) {
  if(err) throw err;
  var dbo = db.db(&quot;data&quot;);
  var schematodo = dbo.collection(&quot;licence&quot;).findOne(obj, function(err, res){
      for (var key in schematodo) {
          
          console.log(indent, key, typeof schematodo[key]) ;
      };
  });
  
  db.close();
  </code></pre>
  <p>});</p>