find = findone
sequelize findAllsequelize createsequelize updatesequelize deletesequelize findAndCounsequelize countdataValues - raw: true.toJSON() 으로 변경해줘야함
great notion
[ORM] Sequelize , 자동 테이블 생성 및 DB 접근
ORM(Object Relational Mapping)은 application과 Database사이를 맵핑시켜주는 도구이다. 한층더 추상화된 layer에서 Database에 대한 작업을 할 수 있게 해준다. ORM을 사용함으로써 얻는 장단점(pros and cons)은 다음과 같다. 1) Pros of ORM 특정 DBMS에 종속되지 않는다. SQL문이 코드에 들어가지 않아 깔끔한 코드를 유지할 수 있다. ORM이 nesting데이터를 바인딩해준다. 2) Conf of ORM RAW query에 비해 performance가 느리다.
https://3dmpengines.tistory.com/1990
great example
Sequelize WHERE sequelize.fn(...) AND something='something' ordering issue
I have a Sequelize findOne function that looks to select a row where the given point intersects a polygon (col 'geom') AND status = 'active'. var point = sequelize.fn('ST_GeomFromText', 'POINT(' + lng + ' ' + lat +')', 4326); var intersects = sequelize.fn('ST_Intersects', sequelize.col('geom'), point); GeoCounty.findOne({ attributes: ['id', 'name' ], where: { status: 'active', $and: intersects }, plain: true }) As of right now, it works just fine.
https://stackoverflow.com/questions/43274383/sequelize-where-sequelize-fn-and-something-something-ordering-issue
toJson()
Sequelize, convert entity to plain object
I'm not very familiar with javascript, and stunning, because i can't add new property, to object, that fetched from database using ORM names Sequelize.js. To avoid this, i use this hack: db.Sensors.findAll({ where: { nodeid: node.nodeid } }).success(function (sensors) { var nodedata = JSON.parse(JSON.stringify(node)); // this is my trick nodedata.sensors = sensors; nodesensors.push(nodedata); response.json(nodesensors); }); So, what normally way to add new properties to object.
https://stackoverflow.com/questions/21961818/sequelize-convert-entity-to-plain-object

Seonglae Cho