Work with . and & in field names (HTTP)
|
For details about additional languages, see: |
You must use & to escape any . or & in field names when the field is used in a filter, sort, projection, update, or indexing clause.
Dot notation, which is used to reference nested fields, should not be escaped.
For example, in the following document, you would use escaping like this: areas.r&&d, costs.price&.usd, and costs.price&.cad.
{
"areas": {
"r&d": true,
"design": false
},
"costs": {
"price.usd": 100,
"price.cad": 90
}
}
You should not escape . or & in field names when you insert or replace a document.
For example:
curl -sS -L -X POST "API_ENDPOINT/api/json/v1/KEYSPACE_NAME/COLLECTION_NAME" \
--header "Token: APPLICATION_TOKEN" \
--header "Content-Type: application/json" \
--data '{
"findOneAndReplace": {
"filter": {"$and": [
{"areas.r&&d": false},
{"costs.price&.usd": {"$lt": 300}}
]},
"replacement": {
"areas": {
"r&d": false,
"design": true
},
"costs": {
"price.usd": 100,
"price.cad": 90
}
},
"projection": {"areas.r&&d": true, "costs.price&.usd": true},
"sort": {
"areas.r&&d": 1,
"costs.price&.usd": -1
}
}
}'