danibram / mocker-data-generator

A simplified way to generate masive mock data based on a schema, you can use the awesome fake/random data generators like (FakerJs, ChanceJs, CasualJs and RandExpJs)
https://danibram.github.io/mocker-data-generator/
MIT License
426 stars 45 forks source link

Cannot read property 'map' of undefined #2

Closed ronakamlani closed 8 years ago

ronakamlani commented 8 years ago

Hello, I have tried most of library but I liked your own data generator..

Once I trying below code it gives me 'Cannot read property 'map' of undefined ' error.

Here is my code.

//At top header .. var mocker = require('mocker-data-generator/lib') var util = require('util') var faker = require('faker') var bcrypt = require('bcrypt');

var mongojs = require('mongojs'); var util = require('util');

//inside event. var m = mocker() .schema('users', config.users, 3) .schema('users2', config.users, {uniqueField: 'email'})

.schema('tags_helper', config.tags_helper,3)

.schema('story', config.story, 5)
.schema('story2', config.story, {uniqueField: 'title'})

.build(function(data){
    console.log(util.inspect(data, {depth:10}))

});

Error indicate near at .build.

Please, send me some solution..

danibram commented 8 years ago

Hi! First of all, thanks for report the issue, this will help to improve the module. Can you pass me the models? Here or by email (info@dbr.io) And also can you write me the node version? I have tests for the module, in every compilation, so maybe its an error on the models. Can you put also a console log to know if config is accesible by the mocker code?

ronakamlani commented 8 years ago

Sure, now i have remove that code and move ahead with duplicate records, but I am sending you code and node.js version.

Thank you so much dude.. :)

danibram commented 8 years ago

I think after analyze the schemas that the are an external problem. Also i updated (v1.2.2) the module with a better catch of the errors, so now we can detect better if it is an issue of the module or external. Thanks!

ronakamlani commented 8 years ago

Thank you so much for contribution. You saved my time..

Thanks.. :)

On Fri, Feb 19, 2016 at 10:07 AM, Daniel Biedma notifications@github.com wrote:

I think after analyze the schemas that the are an external problem. Also i updated (v1.2.2) the module with a better catch of the errors, so now we can detect better if it is an issue of the module or external. Thanks!

— Reply to this email directly or view it on GitHub https://github.com/danibram/mocker-data-generator/issues/2#issuecomment-186047540 .