pow-mongodb-fixtures icon indicating copy to clipboard operation
pow-mongodb-fixtures copied to clipboard

Uncaught TypeError: Cannot read property 'user1' of undefined

Open Clan-Utility opened this issue 9 years ago • 3 comments
trafficstars

For the example

var users = exports.users = {
    user1: {
        _id: id(),
        name: 'Michael'
    },
    user2: {
        _id: id(),
        name: 'George Michael',
        father: users.user1._id
    },
    user3: {
        _id: id('4ed2b809d7446b9a0e000014'),
        name: 'Tobias'
    }
}

Uncaught TypeError: Cannot read property 'user1' of undefined at Object. (test/fixtures/powMongo/fixtures.js:23:22) at _fileToObject (node_modules/pow-mongodb-fixtures/src/index.js:419:14) at node_modules/pow-mongodb-fixtures/src/index.js:400:7

Node v4.2.4

Clan-Utility avatar Oct 30 '16 02:10 Clan-Utility

Same issue here, did you manage to find a solution ? @Clan-Utility

thmsgbrt avatar Oct 29 '18 10:10 thmsgbrt

I did something like this:

var users = exports.users = {
    user1: {
        _id: id(),
        name: 'Michael'
    },
    user2: {
        _id: id(),
        name: 'George Michael'
    },
    user3: {
        _id: id('4ed2b809d7446b9a0e000014'),
        name: 'Tobias'
    }
}

users.user2.father = users.user1._id;

Not elegant at all ...

Clan-Utility avatar Nov 05 '18 15:11 Clan-Utility

Thanks for your feedback ;) At the end, I did it manually, without packages and it worked as I need to... (small fixtures so that's ok)

thmsgbrt avatar Nov 08 '18 08:11 thmsgbrt