Returning documents as one file back from Azure CosmosDB

If you ever tried getting multiple documents from CosmosDB collection as on “file”, than you should do the following steps. There can be different requirements for this, but this is not scope of this blog.

Option I – directly in Azure Portal

(Option II – using Datamigration tool)

Here is, what you can do:

    1. First open up “Data Explorer” in CosmosDB Resource (Azure Portal) and select DB->Collection of your interest.
    2. Click “New SQL Query” -> this opens a new query pane with a select statement and also “Setting” to open up the settings SlideIn.

      new query pane
      new query pane
    3. In that SlideIn you have several options.
      – one is to set a custom value on how many results can be displayed in one page
      – another option is to remove the limitation of default 100 to unlimited

      unlimited page results
      unlimited page results
      custom page limit
      custom page limit

       

      ! Don’t forget to save !

    4. Next, go to query pane and leave the select statement, if you have no other conditions on the outcome. Click “Execute Query”. With this you can now grab the output in the results pane by CTRL+A and CTRL+C

      execute query
      execute query
    5. Open your favorit text editor (I like VScode very much), paste in the clipboard and save as a file.

Here you go! 🙂 Hope this helps. If you have other suggestions, you’re welcome to add comments.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.