How to fill the database table with values on startup of the server


#1

Is there a value to populate the table from within the server directory to ensure the table always has these default values?
Thanks!


#2

Take a look at how this is handled in the Guide’s reference app, within the /imports/startup/server/fixtures.js file. In a nutshell, at startup time first check to see if the desired data exists in your collection. If not, create it.


#3

Thanks got it working, another question on the same topic if you don’t mind:

I am inserting items and one of the properties is the folder path:
src: “assets\img\items\5.png”,

Now it inserts fine but it shows it as the same, basically I just want it with one slashes.
And If I do just insert with the single slashes it shows no slashes?
I have also tried single and double slashes. Any idea what this might be related to?
Thanks