TypeError: Model is not a constructor (mongoose
See original GitHub issuefactory-girl version 4.2.2
I think this is related to #63. I am using Mongoose but otherwise used the same set up suggested there.
var fg = require('factory-girl');
var adapter = new fg.MongooseAdapter();
factory = fg.factory;
factory.setAdapter(adapter);
When running npm test
I get:
TypeError: Model is not a constructor
at MongooseAdapter.build (/Users/stoebelj/freecodecamp/voting/node_modules/factory-girl/index.js:703:14)
at Factory._callee2$ (/Users/stoebelj/freecodecamp/voting/node_modules/factory-girl/index.js:155:33)
at tryCatch (/Users/stoebelj/freecodecamp/voting/node_modules/regenerator-runtime/runtime.js:63:40)
at Generator.invoke [as _invoke] (/Users/stoebelj/freecodecamp/voting/node_modules/regenerator-runtime/runtime.js:337:22)
at Generator.prototype.(anonymous function) [as next] (/Users/stoebelj/freecodecamp/voting/node_modules/regenerator-runtime/runtime.js:96:21)
at step (/Users/stoebelj/freecodecamp/voting/node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30)
at /Users/stoebelj/freecodecamp/voting/node_modules/babel-runtime/helpers/asyncToGenerator.js:28:13
Am I missing something?
Issue Analytics
- State:
- Created 6 years ago
- Comments:15 (2 by maintainers)
Top Results From Across the Web
mongoose TypeError: Schema is not a constructor
I have encountered the same thing. I have previous code like this var mongoose = require('mongoose'); var Schema = mongoose.
Read more >Can't export/require a module mongoose model: TypeError
I'm trying to export a mongoose model and require it on another file. ... a module mongoose model: TypeError: User is not a...
Read more >TypeError: Schema is not a constructor (Example) - Treehouse
TypeError : Schema is not a constructor. Hi all. I wonder if someone can help me, please. :) Here's my code: 'use strict'...
Read more >TypeError: Model is not a Constructor-mongodb - appsloveworld
Making a MongoDB call from a react component on Form Submit with Mongoose throws an error - TypeError: Group is not a constructor...
Read more >Javascript – mongoose TypeError: Schema is not a constructor
Javascript – mongoose TypeError: Schema is not a constructor ... I find it very strange as I have several working schemas. I tried...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
In my case I cleared many errors including this one after correcting this: module.export to module.exports 😊
And I spent an hour or so just to find out that I wrote exports.module instead of module.exports…