得到ETAG只是GET 127.0.0.1:8080/testDB/testCollection?pagesize=0
,你就其属性和中的eTag响应头
http -a a:a 127.0.0.1:8080/db/coll?pagesize=0
HTTP/1.1 200 OK
...
ETag: 58653f6b2d174c09c590262a**
{
"_embedded": [],
"_etag": {
"$oid": "58653f6b2d174c09c590262a"
},
"_id": "coll",
"_returned": 0,
}
也注意到,试图删除集合返回的eTag响应头之间找到它冲突案例
http -a a:a DELETE 127.0.0.1:8080/db/coll
HTTP/1.1 409 Conflict
...
ETag: 58653f6b2d174c09c590262a
{
"http status code": 409,
"http status description": "Conflict",
"message": "The collection's ETag must be provided using the 'If-Match' header."
}
终于可以在配置文件中设置Etag检查行为。
#### ETag policy
# the following configuration defines the default etag check policy
# the policy applies for dbs, collections (also applies to file buckets) and documents
# valid values are REQUIRED, REQUIRED_FOR_DELETE, OPTIONAL
etag-check-policy:
db: REQUIRED_FOR_DELETE
coll: REQUIRED_FOR_DELETE
doc: OPTIONAL
:默认是检查的eTag只删除/ db和/科尔,但可以使任何写请求从conf文件(例如,以避免所谓的鬼写的问题)