O
O
olezhenka2017-03-28 12:29:50
JavaScript
olezhenka, 2017-03-28 12:29:50

How to get user value?

there are two teams. the findOne command looks for a user in the database and the create command creates a user in the database if it is not there.
the value of user will be the same in both cases, so how should I use it? After all, I will not write the same code in each function.
c8d9ce98640f4f649393ceb7efd8a616.PNG

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Anton Anton, 2017-03-28
@Fragster

what are you using as an ORM? sequelize for example has docs.sequelizejs.com/en/v3/api/model/#findorcreate...

A
Anton, 2017-03-28
@pekc83

https://www.npmjs.com/package/mongoose-findorcreate

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question