How to get a substring in dgraph query

172 views Asked by At

When I perform this query

{
  message (func: uid(0x4e22)) {
    message
  }
}

I get the response

{
  "data": {
    "message": [
      {
        "message": "really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message really long message "
      }
    ]
  },
  ...
}

But I would like my returned data to have a shortened preview version of message, something like the following

        "message": "really long message rea"

Is there any way in dgraph query language to return a substring like this?

1

There are 1 answers

0
amaster On BEST ANSWER

There is not currently. With the upcoming @lambda directive and javascript hook functions, you can have such features. Version 20.11 is exepected to be released early November, 2020.