Skip to content

RDoc-3767 Copy attachments via Patch Scripts#2371

Merged
reebhub merged 2 commits intoravendb:mainfrom
Danielle9897:RDoc-3767-copyAttachmentsViaScript
Apr 13, 2026
Merged

RDoc-3767 Copy attachments via Patch Scripts#2371
reebhub merged 2 commits intoravendb:mainfrom
Danielle9897:RDoc-3767-copyAttachmentsViaScript

Conversation

@Danielle9897
Copy link
Copy Markdown
Member

Issue link

https://issues.hibernatingrhinos.com/issue/RDoc-3767/Copy-attachments-via-Patch-Scripts

Additional description

Document the new copyFrom script method.

Type of change

  • Content - docs
  • Content - cloud
  • Content - guides
  • Content - start pages/other
  • New docs feature (consider updating /templates or readme)
  • Bug fix
  • Optimization
  • Other

Changes in docs URLs

  • No changes in docs URLs
  • Articles are restructured, URLs will change, mapping is required (update /scripts/redirects.json file, set Documents Moved PR label)

Changes in UX/UI

  • No changes in UX/UI
  • Changes in UX/UI (include screenshots and description)

@Danielle9897 Danielle9897 requested a review from golan22888 March 29, 2026 15:15
| Return value | Description |
|--------------|-------------|
| `true` | The attachment was copied successfully. |
| `false` | The source document or the source attachment was not found. No exception is thrown. |
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want to add here the case when the destination document is not found?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done - added.

Comment thread docs/server/kb/javascript-engine.mdx Outdated
|----------------------------------------------------------------------------------|-------------|-----------------------------------------------------------------------------------------------------------------|
| **attachments(document, attachmentName)<br/>.remote(destinationID, uploadTime)** | `void` | Updates the document's metadata with remote parameters to schedule the attachment for upload to remote storage.<br/>See [Schedule attachment for remote upload](../../document-extensions/attachments/store-attachments/store-attachments-remote.mdx#schedule-existing-attachments-for-remote-upload). |
| **attachments(document, attachmentName)<br/>.delete()** | `void` | Deletes the specified attachment from the document.<br/>See [Delete attachment via patching](../../document-extensions/attachments/delete-attachment.mdx#delete-attachment---via-a-patch). |
| **attachments(targetDocument, targetAttachmentName)<br/>.copyFrom(sourceDocId, sourceName)** | `boolean` | Copies an attachment from a source document to the target document with the specified name.<br/>Returns `true` on success, `false` if the source attachment does not exist.<br/>See [Copy attachment via patching](../../document-extensions/attachments/copy-move-rename.mdx#copy-attachments---via-patching). |
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about those cases:
destination doc is not found?
source doc is not found?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done - added.

| Return value | Description |
|--------------|-------------|
| `true` | The attachment was copied successfully. |
| `false` | The source document or the source attachment was not found. No exception is thrown. |
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done - added.

Comment thread docs/server/kb/javascript-engine.mdx Outdated
|----------------------------------------------------------------------------------|-------------|-----------------------------------------------------------------------------------------------------------------|
| **attachments(document, attachmentName)<br/>.remote(destinationID, uploadTime)** | `void` | Updates the document's metadata with remote parameters to schedule the attachment for upload to remote storage.<br/>See [Schedule attachment for remote upload](../../document-extensions/attachments/store-attachments/store-attachments-remote.mdx#schedule-existing-attachments-for-remote-upload). |
| **attachments(document, attachmentName)<br/>.delete()** | `void` | Deletes the specified attachment from the document.<br/>See [Delete attachment via patching](../../document-extensions/attachments/delete-attachment.mdx#delete-attachment---via-a-patch). |
| **attachments(targetDocument, targetAttachmentName)<br/>.copyFrom(sourceDocId, sourceName)** | `boolean` | Copies an attachment from a source document to the target document with the specified name.<br/>Returns `true` on success, `false` if the source attachment does not exist.<br/>See [Copy attachment via patching](../../document-extensions/attachments/copy-move-rename.mdx#copy-attachments---via-patching). |
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done - added.


* **No exception is thrown** in the following cases:
* The source document does not exist.
* The source attachment does not exist.
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed this line

@Danielle9897 Danielle9897 requested a review from golan22888 April 13, 2026 09:00
Copy link
Copy Markdown

@golan22888 golan22888 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@reebhub reebhub merged commit 824eca6 into ravendb:main Apr 13, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants