#Typeorm : want to get the same result of getRawMany() as getMany().

6 messages · Page 1 of 1 (latest)

fiery yacht
#

Hello.
Currently, we are running a query using getRawMany() to use the function 'SUM in MYSQL'.

As I received it with raw data, json is not pretty, so I want to receive it as a pretty json like getMany.

Is this supported by typeorm?
Is there any other way if I don't apply?

getRawMany()

{
    "feed_id": 1,
    "feed_content": "Test",
    "community_id": 1,
    "community_name": "Name",
    "postedUser_id": 1,
    "postedUser_nickname": "Nickname",
    "postedUser_profileImage": null,
}

I want the format below.

{
    "feed": {
        "id": 1,
        "content": "Test"
    },
    "community": {
        ...
    },
    "postedUser": {
        ...
    }
}
ornate vortex
#
#

it's not supported by typeorm, but if you pass the result through this utility (with the separator set to _), you'll get the format you want.

fiery yacht
fiery yacht
ornate vortex
#

uh, no idea about that, sorry :/