以下は、couchbase のサンプル ドキュメント (userdetails) です。
{ "friends":[
{
"company":"microsoft",
"firstname":"criss",
"lastname":"angel"
},
{
"company":"google",
"firstname":"captain",
"lastname":null
} ] }
会社名に基づいて、それぞれの json ドキュメントを配列から削除したいと考えています。
n1ql クエリ
update default use keys "userdetails" set friends=array_remove(friends,a) for a in friends when a.company="google" end returning friends
上記のクエリを使用してjsonデータを削除できません。
null 値ではなく 空の文字列 ( "lastname" : " " )がある場合、このクエリは適切に機能します。
したがって、パラメーター値のいずれかが「null」の場合、削除する方法