Skip to content

Instantly share code, notes, and snippets.

@IlanFrumer
Created January 1, 2014 07:33
Show Gist options
  • Save IlanFrumer/8205903 to your computer and use it in GitHub Desktop.
Save IlanFrumer/8205903 to your computer and use it in GitHub Desktop.
Faker = require 'Faker'
mongoose = require 'mongoose'
UserSchema = new mongoose.Schema {
_id: String
name: String
}
User = mongoose.model('User', UserSchema)
mongoose.connect('mongodb://localhost/myapp')
User.remove (err)->
for i in [1..1000]
user = new User {
_id: Faker.Internet.email()
name: Faker.Name.findName()
}
user.save (err, data)->
throw err if err
console.log "saved #{JSON.stringify(data)}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment