我正在使用riak php客户端,并拥有数据类型映射。我想删除整个map,也就是itemid。这是我的代码
$location = new Location($itemID, $this->itemBucket);
$map = (new CommandBuilderFetchMap($this->riak))
->atLocation($location)
->build()
->execute()->getMap();
(new CommandBuilderUpdateMap($this->riak))
->removeMap($itemID)
->atLocation($location)
->withContext($map->getContext())
->build()
->execute();
我想你混淆了包含映射对象的KV键和包含嵌套映射的映射键。
此位置将参考"http://riaknode:8098/buckets/$this->itemBucket/keys/$itemID"
$location = new Location($itemID, $this->itemBucket);
检索上述桶/键
所包含的映射对象。 $map = (new CommandBuilderFetchMap($this->riak))
->atLocation($location)
->build()
->execute()->getMap();
尝试从返回的映射对象
中删除键为$itemID
的元素。 (new CommandBuilderUpdateMap($this->riak))
->removeMap($itemID)
->atLocation($location)
->withContext($map->getContext())
->build()
->execute();
如果你想删除存储在bucket/key下的整个地图,你可能需要使用CommandBuilderDeleteObject