how do you - You can call the loadExampleData function at model.js in order to create these entries automatically.
vsantoro opened this issue · 5 comments
how do you get the data to insert into mongo db ?
You can call the loadExampleData function at model.js in order to create these entries automatically.
I tried just calling that function and its not going in.
First, you need to install mongodb and set connection details in app.js
. Then, calling loadExampleData should load your database.
thanks , its working now.
Can't seem to call loadExampleData for some reason even after DB connected I have added the following to the app.js
import loadExampleData from './model.js';
and I get this error
SyntaxError: Cannot use import statement outside a module
at Object.compileFunction (node:vm:352:18)
at wrapSafe (node:internal/modules/cjs/loader:1027:15)
at Module._compile (node:internal/modules/cjs/loader:1063:27)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:975:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47
This issue was closed, but I think you are calling the function from outside model.js. You should modify that file to add a call to the local function.