Creates a :class:`.Spec` for removing a field from a document. Args: path (str): The path to the field. xattr (bool, optional): Whether this operation should reference the document body or the extended attributes data for the document. Returns: :class:`.
(path, # type: str
xattr=False, # type: Optional[bool]
)
| 464 | |
| 465 | |
| 466 | def remove(path, # type: str |
| 467 | xattr=False, # type: Optional[bool] |
| 468 | ) -> Spec: |
| 469 | """Creates a :class:`.Spec` for removing a field from a document. |
| 470 | |
| 471 | Args: |
| 472 | path (str): The path to the field. |
| 473 | xattr (bool, optional): Whether this operation should reference the document body or the |
| 474 | extended attributes data for the document. |
| 475 | |
| 476 | Returns: |
| 477 | :class:`.Spec`: An instance of :class:`.Spec`. |
| 478 | |
| 479 | """ |
| 480 | if not path: |
| 481 | return Spec(SubDocOp.REMOVE_DOC, '', False, xattr, False) |
| 482 | return Spec(SubDocOp.REMOVE, path, False, xattr, False) |
| 483 | |
| 484 | |
| 485 | def array_append(path, # type: str |