質問

私は、null値をフィルタリングMQLのクエリを記述しようとしています。

私が今持っているクエリは(MQLクエリエディタのrel="noreferrer">

[
  {
    "/common/topic/image" : [
      {
        "id" : null
      }
    ],
    "article" : [
      {
        "content" : null
      }
    ],
    "name" : "bill gates",
    "type" : "/common/topic"
  }
]
私は取得しています。

結果:

[
  {
    "/common/topic/image" : [
      {
        "id" : "/guid/9202a8c04000641f8000000004fb4c01"
      },
      {
        "id" : "/wikipedia/images/commons_id/4486276"
      }
    ],
    "article" : [
      {
        "content" : null
      },
      {
        "content" : "/guid/9202a8c04000641f800000000903535d"
      }
    ],
    "name" : "Bill Gates",
    "type" : "/common/topic"
  }
]
問合せ時に「記事」配列にはnull試合:

私は、「コンテンツ」を除外することができる方法を把握しようとしています。私は、MQLのドキュメントを通じて見えたが、私はこれを行うための明確な方法が表示されませんでした。

役に立ちましたか?

解決

あなたがコンテンツid属性を拡張し、falseにオプションのディレクティブを設定する必要がありますそれらに割り当てられているすべてのコンテンツを持っていない記事をフィルタリングする。

[
  {
    "/common/topic/image" : [
      {
        "id" : null
      }
    ],
    "article" : [
      {
        "content" : {
          "id" : null,
          "optional" : false
        }
      }
    ],
    "name" : "bill gates",
    "type" : "/common/topic"
  }
]

このはあなたに次のような結果が得られます。

[
  {
    "/common/topic/image" : [
      {
        "id" : "/guid/9202a8c04000641f8000000004fb4c01"
      },
      {
        "id" : "/wikipedia/images/commons_id/4486276"
      }
    ],
    "article" : [
      {
        "content" : {
          "id" : "/guid/9202a8c04000641f800000000903535d"
        }
      }
    ],
    "name" : "Bill Gates",
    "type" : "/common/topic"
  }
]

オプションのディレクティブを使用しての詳細についてはこちらをのドキュメントを参照してください。

scroll top