title: Bacon.js and RxJS with Express.js and Mongoose.js
body: <p>I'm using Bacon.js on the server side with Express.JS (version 4.x)</p>
  
  <p>This method never responds! Am I doing something extremely wrong here?</p>
  
  <pre><code>var User = require('../data/User');
  var Bacon = require('baconjs').Bacon;
  
  module.exports = function(router){
         router.route('/users').get(function(req, res){
  
             var result = Bacon.fromNodeCallback(User.find, null);
  
             result.onValue(function(docs){
                 res.status(200).send(docs);
             });
  
             result.onError(function(err){
                 res.status(500).send(err);
             });
  
      });
  };
  </code></pre>
  
  <p>Apparently I'm failing with RxJS as well...</p>
  
  <pre><code>var User = require('../data/User');
  var Rx = require('rx');
  
  module.exports = function(router){
      router.route('/users').get(function(req, res){
  
          var query = Rx.Observable.fromNodeCallback(User.find)();
  
          query.subscribe(function(docs){
              res.send(docs);
          }, function(err){
              res.send('Error: ' + err);
          }, function(){
              console.log("COMPLETED");
          })
  
      });
  };
  </code></pre>
  
  <p>This is the error that is returned:</p>
  
  <pre><code>Error: TypeError: Cannot read property 'discriminatorMapping' of undefined
  </code></pre>