1

aliasName: -1

The value of aliasName is -1.

enter image description here

aliasName: undefined

aliasName is giving me undefined. enter image description here

Machavity
  • 30,841
  • 27
  • 92
  • 100
  • `likess`? Two `s`s? You seem to have been consistent, so it should work, just checking. – T.J. Crowder Aug 14 '17 at 18:45
  • Can you show the generated HTML rather than the rendered web page? – Dancrumb Aug 14 '17 at 18:46
  • 1
    Yes, because the normal column is named likes so I just put two s for the other one. –  Aug 14 '17 at 18:47
  • Also when I do console.log(posts[0].likess); in nodejs its returning undefined for some reason. I think its an alias problem in sequelize. I cannot access alias for some reason. When I use alias "likess". [models.sequelize.fn('sum', models.sequelize.col('likes')), 'likess']] –  Aug 14 '17 at 18:52
  • what is the console log for: `console.log(posts);` in your code? – Peter Aug 14 '17 at 19:12
  • 4
    Please don't make more work for other people by vandalizing your posts. By posting on the Stack Exchange network, you've granted a non-revocable right, under the [CC BY-SA 4.0 license](//creativecommons.org/licenses/by-sa/4.0/), for Stack Exchange to distribute that content (i.e. regardless of your future choices). By Stack Exchange policy, the non-vandalized version of the post is the one which is distributed. Thus, any vandalism will be reverted. If you want to know more about deleting a post please see: [How does deleting work?](//meta.stackexchange.com/q/5221) – Machavity Dec 18 '19 at 15:43

1 Answers1

3

Did this and worked.

posts[0].get('aliasName')

  • Thanks for pointing this out! Added some documentation mentions of this at: https://stackoverflow.com/questions/32649218/how-do-i-select-a-column-using-an-alias/69890944#69890944 now. – Ciro Santilli OurBigBook.com Nov 08 '21 at 23:08