I am running this on Node.js version 6.9.5
I have this code:
let {Schema}, mongoose = require('mongoose');
which is in theory a simplified version of:
let mongoose = require('mongoose');
let Schema = mongoose.Schema;
I get this error:
let {Schema}, mongoose = require('mongoose');
^^^^^^^^
SyntaxError: Missing initializer in destructuring declaration
I tried this instead:
let mongoose, {Schema} = require('mongoose');
I got a different error, which was the result of "mongoose" being undefined.
I thought it was possible to do something like this, what am I doing wrong?
via Alexander Mills
No comments:
Post a Comment