Closed sdg002 closed 4 years ago
Hi @sdg002, do you want to just return the RAW JSON of the document, rather than the document object?
You could just convert that to json using ConvertTo-Json
- e.g. Get-CosmosDbDocument -Context $cosmosDbContext -CollectionId 'MyNewCollection' -Id $documents[0].id -PartitionKey $documents[0].id | ConvertTo-Json -Depth 20
.
However, I'm assuming you're probably wanting the document "exactly" as it is returned from Cosmos DB - is that correct? In which case I could easily implement a -Raw
parameter that would just return the RAW json - would that address your requirement?
A parameter like -Raw
might work well.
Or, a new purpose built cmdlet like Get-CosmosDbDocumentJson
so that the intent is very clear to the consumer and there is no confusion with Get-CosmosDbDocument
which is already doing a great job.
Great Idea - I'll use the Get-CosmosDbDocumentJson
. What I can do is actually just make Get-CosmosDbDocument
a wrapper around Get-CosmosDbDocumentJson
which will eliminate any code duplication.
I'll get onto this later today.
Issue
Before submitting your issue for the CosmosDB project, please take a moment to provide the following details:
Get-Module -Name CosmosDB
) Thanks for contributing your feedback and support! You can optionally submit a Pull Request against this project, if you have a fix you'd like to share.Scenario
I would like to dump documents from my collection using a query into a physical folder. I would like to make some minor changes and then save them back.
Get-CosmosDbDocument
This worked well. But, it gave me a tabular result set - which is also very useful in other scenarios.
Thanks, Sau