Just upgraded to node 4.1.2 and using Mongorito (which uses ES6) to access Mongo, and I get the following:
Model File:
var Mongorito = require('mongorito'); var Model = Mongorito.Model; var config = require('../config/config'); Mongorito.connect(config.mongo.url); class Listing extends Model {} module.exports = Listing;
And I turn it on:
var Listing = require('../models/listing'); var listing = yield Listing.where('cacheKey', key).findOne();
TypeError: Class constructors cannot be invoked without 'new' at Listing.Model (/node_modules/mongorito/lib/mongorito.js:140:15) at new Listing (/models/listing.js:7:14) at Query.find (/node_modules/mongorito/lib/query.js:355:21) at [object Generator].next (native) at onFulfilled (/node_modules/koa/node_modules/co/index.js:65:19) at run (/node_modules/babel/node_modules/babel-core/node_modules/core-js/modules/es6.promise.js:89:39) at /node_modules/babel/node_modules/babel-core/node_modules/core-js/modules/es6.promise.js:100:28 at flush (/node_modules/babel/node_modules/babel-core/node_modules/core-js/modules/$.microtask.js:17:13) at doNTCallback0 (node.js:408:9) at process._tickCallback (node.js:337:13)
source share