I'm new to Massive, but I really like it. While using express.Router()
and making a very simple db call:
router.get('/:id', function(req, res, next) {
db.accounts.find(req.params.id, function(err, results) {...});
I obtained an error:
Error: Argument 0 (conditions) should be type Object, but it was type string with value 2. at Args (C:\Users\JMichelson\WebstormProjects\Proximityv6\node_modules\args-js\Args.js:399:10) at Object.exports.forArgs (C:\Users\JMichelson\WebstormProjects\Proximityv6\node_modules\massive\lib\arg_types.js:7 7:10) ...
Which was resolved with a simple cast:
router.get('/:id', function(req, res, next) {
db.accounts.find(Number(req.params.id), function(err, results) {...});
But I find that this casting requirement to be strange since JavaScript should automatically cast as necessary.
Am I doing this correctly?