title: How to make minimongo.js works in browser?
body: <p>The <a href="https://github.com/mWater/minimongo" rel="nofollow noreferrer">github presentation of minimongo</a> states it as</p>
  
  <blockquote>
    <p>Client-side mongo database with server sync over http</p>
  </blockquote>
  
  <p>There is a also a <a href="https://github.com/rurri/minimongo-standalone" rel="nofollow noreferrer">minimongo-standalone</a> providing a minimongo.min.js which states :</p>
  
  <blockquote>
    <p>You could also just download the minimongo.min.js, place it on your
    server, and reference it in your source.</p>
    
    <p>For browsers</p>
    
    <p><code>&lt;script src="/js/minimongo.min.js"&gt;&lt;/script&gt;</code></p>
  </blockquote>
  
  <p>I previously used d3.js which is packaged in a way so the .js file works both in web-browsers as a lib and on nodes as a npm packages.</p>
  
  <p>So I tried locally with my newly downloaded <code>minimongo.js</code> to build a classic webpage with <code>indexeddb</code> in Chrome as I would do with D3.js. It gives something like that (<a href="https://jsfiddle.net/7fehe9ey/5/" rel="nofollow noreferrer">jsfiddle</a>) :</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  
  &lt;html lang="en"&gt;
    &lt;head&gt;
      &lt;meta charset="utf-8"&gt;
      &lt;title&gt;MiniMongo&lt;/title&gt;
      &lt;script src="https://rawgit.com/rurri/minimongo-standalone/master/minimongo.min.js"&gt;&lt;/script&gt;
      &lt;!-- https://github.com/rurri/minimongo-standalone/blob/master/minimongo.min.js --&gt;
    &lt;/head&gt;
    &lt;body&gt;&lt;/body&gt;
    &lt;script&gt;
      // Require minimongo
      var minimongo = require("minimongo");
      var LocalDb = minimongo.MemoryDb;
      // Create local db (in memory database with no backing)
      db = new LocalDb();
      // Add a collection to the database
      db.addCollection("animals");
      doc = { species: "dog", name: "Bingo" };
      // Always use upsert for both inserts and modifies
      db.animals.upsert(doc, function() {
        // Query dog (with no query options beyond a selector)
        db.animals.findOne({
          species: "dog"
        }, {}, function(res) {
          console.log("Dog's name is: " + res.name);
        });
      });
  
    &lt;/script&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>It returns the errors :</p>
  
  <pre><code>Uncaught ReferenceError: _ is not defined
      at minimongo.min.js:1
      at minimongo.min.js:3
  Uncaught ReferenceError: require is not defined
      at (index):5911
  Uncaught ReferenceError: _ is not defined
      at (index):91
      at window.onload ((index):5889)
  </code></pre>
  
  <p><strong>What am I missing or misunderstanding ? 
  How to make it work if possible ?</strong></p>