简体   繁体   English

没有元数据的 RestHeart 响应

[英]RestHeart Response without metadata

How can I get a RestHeart response without metadata when I query a collection?查询集合时如何获得没有元数据的 RestHeart 响应? (like "_embedded", "_id", "_returned") Example: (如“_embedded”、“_id”、“_returned”)示例:

https://restheart.url/test https://restheart.url/test

{
  "_embedded": [
    {
      "_id": "5c530d6381e931ba5992ea35",
      "isActive": true,
      "age": 35
    },
    {
      "_id": "5c530d63602cca9789a4ddb0",
      "isActive": true,
      "age": 36
    },
    {
      "_id": "5c530d63275c5a64b643ed4a",
      "isActive": true,
      "age": 37
    },
    {
      "_id": "5c530d63eddff83681b51ebf",
      "isActive": true,
      "age": 27
    },
    {
      "_id": "5c530d63d6ed461d02948520",
      "isActive": true,
      "age": 30
    },
    {
      "_id": "5c530d639ef0e13b0cb6f3d7",
      "isActive": true,
      "age": 24
    }
  ],
  "_id": "test",
  "_returned": 6
}

The answer is using the QueryString parameter "np".答案是使用 QueryString 参数“np”。 Documentation: https://restheart.org/learn/representation-format/文档: https : //restheart.org/learn/representation-format/

https://restheart.url/test?np https://restheart.url/test?np

[
    {
      "_id": "5c530d6381e931ba5992ea35",
      "isActive": true,
      "age": 35
    },
    {
      "_id": "5c530d63602cca9789a4ddb0",
      "isActive": true,
      "age": 36
    },
    {
      "_id": "5c530d63275c5a64b643ed4a",
      "isActive": true,
      "age": 37
    },
    {
      "_id": "5c530d63eddff83681b51ebf",
      "isActive": true,
      "age": 27
    }
  ]

Te answer above from Miguel Santos was totally correct.来自Miguel Santos 的上述回答是完全正确的。 I just want to add that in RESTHeart v4 (released on June 2019) the default representation format has changed, so it's not HAL anymore and it doesn't use the "embedded" object, unless one configures RESTHeart to do so.我只想补充一点,在 RESTHeart v4(2019 年 6 月发布)中,默认表示格式已更改,因此它不再是 HAL,并且不使用“嵌入”对象,除非将 RESTHeart 配置为这样做。

Following several community feedbacks, RESTHeart Platform v4 introduces a new default representation format that is more compact, easy to use and effective.根据多个社区的反馈,RESTHeart Platform v4 引入了一种新的默认表示格式,该格式更加紧凑、易于使用和有效。

Note : the previous HAL format is still available, but you need to edit the configuration.注意:以前的 HAL 格式仍然可用,但您需要编辑配置。

See upgrade-to-v4请参阅升级到 v4

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM