Filtering documents by CreatedAt date during export/import with Smuggler #20795
Closed
marcopornic
started this conversation in
General
Replies: 1 comment 2 replies
-
I eventually found a working solution by using a transform script in the export options instead of a filter script. The transform script allows me to skip documents that do not match my criteria, and it works as expected. Here's the working code:
Using this approach, only documents older than the specified date are exported, and the rest are ignored. I can confirm this works well when streaming directly between two databases using:
Hopefully this helps others looking to filter documents during export. Best regards, |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi RavenDB team,
I have multiple collections containing thousands of documents, and I want to move data from one database to another based on a document’s CreatedAt field (for example, only documents older than 7 days).
I have tried to filter documents during export with Smuggler, but no matter what filter I apply, all documents are exported.
Here is an example of the export code I’m using (in C#):
However, this filter is ignored and all documents are exported.
Is there a recommended way to filter documents during export or import based on a field value?
Is filtering on import with a transform script the best way, or is there a better approach?
Thanks in advance for your help!
Beta Was this translation helpful? Give feedback.
All reactions