Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Test user name and ID
- var userName = 'test',
- userID = 'BYWBSgfnPL6lpMmS'
- /* Function to populate db with test documents
- *
- */
- async function populate(hh) {
- // wait for the database connection
- await hh.connect()
- let hubuser =
- await hh.createHubUser(userName, 'password')
- let user =
- await hh.createUser(userName, {
- _id: userID,
- hubuser: hubuser._id // ссылка на документ hubuser
- })
- let u = await models.User.findOne({username: userName})
- console.log(user.toJSON())
- console.log(u.toJSON())
- }
- // Странные дела, вот это не так, как мы с тобой предпологали!!!
- { _id: 'BYWBSgfnPL6lpMmS',
- username: 'test',
- hubuser: 'E5yYmj4Pyr3N7E51' }
- { _id: 'BYWBSgfnPL6lpMmS',
- username: 'test',
- hubuser:
- { _id: 'E5yYmj4Pyr3N7E51',
- username: 'test',
- password: 'password',
- token: { value: undefined, expires: undefined } } }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement