Size: a a a

Sequelize - community (eng/ru)

2020 January 02

LA

Luis Azcuaga in Sequelize - community (eng/ru)
Model.find({
...
include: {
model: AnotherModel,
limit:1
})
источник

YE

Yulaf Ezmesi in Sequelize - community (eng/ru)
Okey i'll try tknks
источник

LA

Luis Azcuaga in Sequelize - community (eng/ru)
Yulaf Ezmesi
wait, why is limit inside brackets? { }
источник

LA

Luis Azcuaga in Sequelize - community (eng/ru)
You could put "limit" inside the same object, rather than next to it
источник

LA

Luis Azcuaga in Sequelize - community (eng/ru)
{
 where: {
   PK:
 },
 include: {
 ...
 },
 limit: 1
}
источник

LA

Luis Azcuaga in Sequelize - community (eng/ru)
It's easier to read for me like this :P
источник

YE

Yulaf Ezmesi in Sequelize - community (eng/ru)
Luis Azcuaga
{
 where: {
   PK:
 },
 include: {
 ...
 },
 limit: 1
}
İ will share tomarrow my style
источник

YE

Yulaf Ezmesi in Sequelize - community (eng/ru)
You're best way i think
источник

LA

Luis Azcuaga in Sequelize - community (eng/ru)
Perfect :)
источник
2020 January 03

LA

Luis Azcuaga in Sequelize - community (eng/ru)
Yulaf did it work friend?
источник

YE

Yulaf Ezmesi in Sequelize - community (eng/ru)
Yes dude @luisazcuaga its work but i cant use es6 express
источник

LA

Luis Azcuaga in Sequelize - community (eng/ru)
источник

YE

Yulaf Ezmesi in Sequelize - community (eng/ru)
Asyc await and promise all didnt work :(
источник

LA

Luis Azcuaga in Sequelize - community (eng/ru)
Well that is not sequelize related, I’ll PM you
источник
2020 January 05

LA

Luis Azcuaga in Sequelize - community (eng/ru)
I have an interesting doubt
источник

LA

Luis Azcuaga in Sequelize - community (eng/ru)
I have 3 tables.

Users, Sensors and Alerts

I want to findAll Users including Sensors and Alerts

I want to show the included tables count of the elements and a sum of a column in Alerts.

Desired output -> User has 2 sensors, 3 alerts and the sum is 500.
источник

LA

Luis Azcuaga in Sequelize - community (eng/ru)
My attempt was this, but no matter what I write inside COUNT and SUM, it itterates n*m times on the elements. Where n is the number of sensors and m is the number of alerts.
источник

LA

Luis Azcuaga in Sequelize - community (eng/ru)
three alerts (actual data)
источник

LA

Luis Azcuaga in Sequelize - community (eng/ru)
4 sensors
источник

LA

Luis Azcuaga in Sequelize - community (eng/ru)
источник