Skip to content

Commit d77f92c

Browse files
committed
docs: Add information about document path syntax used in CollectionModify
1 parent 5e29865 commit d77f92c

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

include/mysqlx/devapi/collection_crud.h

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,8 @@ class CollectionFind
380380
or a list (or collection) of strings of the form
381381
`"<expression> AS <path>"`. In the latter case each `<expression>`
382382
is evaluated and `<path>` specifies where to put the value of
383-
the expression in the resulting document.
383+
the expression in the resulting document (see `CollectionModify` for more
384+
information about document paths).
384385
*/
385386

386387
template <typename... Expr>
@@ -434,6 +435,24 @@ struct Collection_modify_base
434435
/**
435436
An operation which modifies all or selected documents in a collection.
436437
438+
Note that in operations such as `set()`, `unset()`, `arrayInsert()` and
439+
`arrayAppend()` the field argument is specified as a document path. It can be
440+
a simple field name, but it can be a more complex expression like
441+
`$.foo.bar[3]`. One consequence of this is that document field names that
442+
contain spaces or other special characters need to be quoted, for example one
443+
needs to use this form
444+
```
445+
.unset("\"field name with spaces\"")
446+
```
447+
as `.unset("field name with spaces")` would be an invalid document path
448+
expression.
449+
450+
Note also that wildcard paths that use `*` or `**` are not valid for these
451+
operations that modify documents.
452+
453+
See [MySQL Reference Manual](https://dev.mysql.com/doc/refman/en/json.html#json-path-syntax)
454+
for more information on document path syntax supported by MySQL server.
455+
437456
@ingroup devapi_op
438457
*/
439458

0 commit comments

Comments
 (0)