Mongo Server
  • Introduction
  • Getting started
  • Basics
    • Routing and Queries
    • Restrict endpoints
    • Route logic
    • Default values
    • Input validation and Output Formatting
  • Auth and permissions
    • Login and authentication
    • Permission handling
    • Local authentication
    • Magic Links and codes
  • Automatic Documentation
    • Server description
    • Swagger Docs
  • Miscellaneous
    • Db Seeding
    • Mailing settings
    • Roadmap
    • Population Constrains
Powered by GitBook
On this page

Was this helpful?

  1. Miscellaneous

Db Seeding

You can seed your database using libraries like faker JS and Casual

const casual= require('casual')
module.exports= {
    resources: {
      dogs: {
        seed:()=>({
          name: casual.name
          color: casual.color_name
        })
      },
      mouses:{
        seed: ()=>[{name:"Minnie"},{name:"Mickey"}] // another way to seed dbs
      }
    },
    seed:true, // this can also be a object being every key a resource seeder
    // if you set this this to true, you will delete the db and force seeding! be careful
    forceSeed:false,
  }
PreviousSwagger DocsNextMailing settings

Last updated 6 years ago

Was this helpful?