FSharp.Azure.Cosmos
1.0.0
dotnet add package FSharp.Azure.Cosmos --version 1.0.0
NuGet\Install-Package FSharp.Azure.Cosmos -Version 1.0.0
<PackageReference Include="FSharp.Azure.Cosmos" Version="1.0.0" />
<PackageVersion Include="FSharp.Azure.Cosmos" Version="1.0.0" />
<PackageReference Include="FSharp.Azure.Cosmos" />
paket add FSharp.Azure.Cosmos --version 1.0.0
#r "nuget: FSharp.Azure.Cosmos, 1.0.0"
#addin nuget:?package=FSharp.Azure.Cosmos&version=1.0.0
#tool nuget:?package=FSharp.Azure.Cosmos&version=1.0.0
FSharp.Azure.Cosmos
An F# idiomatic wrapper for Azure Cosmos DB SDK that provides strongly-typed response handling and computation expressions for all Cosmos DB operations.
Features
F# Idiomatic Operations
- Responds with discriminated unions for each Cosmos DB operation to handle status codes as values instead of exceptions
- F# computation expressions for all Cosmos DB operations:
- Read
- ReadMany
- Create
- Replace
- Upsert
- Delete
- Patch
- Unique key definition through computation expressions
- Extension methods for executing operations defined with computation expressions
Modern Query Support
- Query extensions that create
IAsyncEnumerable
(TaskSeq
) fromFeedIterator
/IQueryable
CancellableTaskSeq
module
Builds
GitHub Actions |
---|
NuGet
Package | Stable | Prerelease |
---|---|---|
FSharp.Azure.Cosmos |
Developing
Make sure the following requirements are installed on your system:
- dotnet SDK 8.0 or higher
or
Environment Variables
CONFIGURATION
will set the configuration of the dotnet commands. If not set, it will default to Release.CONFIGURATION=Debug ./build.sh
will result in-c
additions to commands such as indotnet build -c Debug
ENABLE_COVERAGE
Will enable running code coverage metrics. AltCover can have severe performance degradation so code coverage evaluation are disabled by default to speed up the feedback loop.ENABLE_COVERAGE=1 ./build.sh
will enable code coverage evaluation
Building
build.cmd <optional buildtarget> // on windows
./build.sh <optional buildtarget>// on unix
Build Targets
Clean
- Cleans artifact and temp directories.DotnetRestore
- Runs dotnet restore on the solution file.DotnetBuild
- Runs dotnet build on the solution file.FSharpAnalyzers
- Runs BinaryDefense.FSharp.Analyzers.DotnetTest
- Runs dotnet test on the solution file.GenerateCoverageReport
- Code coverage is run duringDotnetTest
and this generates a report via ReportGenerator.ShowCoverageReport
- Shows the report generated inGenerateCoverageReport
.WatchTests
- Runs dotnet watch with the test projects. Useful for rapid feedback loops.GenerateAssemblyInfo
- Generates AssemblyInfo for libraries.DotnetPack
- Runs dotnet pack. This includes running Source Link.SourceLinkTest
- Runs a Source Link test tool to verify Source Links were properly generated.PublishToNuGet
- Publishes the NuGet packages generated inDotnetPack
to NuGet via paket push. Runs only fromGithub Actions
.GitRelease
- Creates a commit message with the Release Notes and a git tag via the version in theRelease Notes
.GitHubRelease
- Publishes a GitHub Release with the Release Notes and any NuGet packages. Runs only fromGithub Actions
.FormatCode
- Runs Fantomas on the solution file.CheckFormatCode
- Runs Fantomas --check on the solution file.BuildDocs
- Generates Documentation fromdocsSrc
and the XML Documentation Comments from your libraries insrc
.WatchDocs
- Generates documentation and starts a webserver locally. It will rebuild and hot reload if it detects any changes made todocsSrc
files, or libraries insrc
.
Releasing
- Start a git repo with a remote git init git add . git commit -m "Scaffold" git branch -M main git remote add origin https://github.com/fsprojects/FSharp.Azure.Cosmos.git git push -u origin main
- Create an Environment on your repository named
nuget
. - Create a NuGet API key
- Add your
NUGET_TOKEN
to the Environment Secrets of your newly created environment. - Then update the
CHANGELOG.md
with an "Unreleased" section containing release notes for this version, in KeepAChangelog format.
NOTE: Its highly recommend to add a link to the Pull Request next to the release note that it affects. The reason for this is when the RELEASE
target is run, it will add these new notes into the body of git commit. GitHub will notice the links and will update the Pull Request with what commit referenced it saying "added a commit that referenced this pull request". Since the build script automates the commit message, it will say "Bump Version to x.y.z". The benefit of this is when users goto a Pull Request, it will be clear when and which version those code changes released. Also when reading the CHANGELOG
, if someone is curious about how or why those changes were made, they can easily discover the work and discussions.
Releasing Documentation
- Set Source for "Build and deployment" on GitHub Pages to
GitHub Actions
. - Documentation is auto-deployed via GitHub Action to Your GitHub Page
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- FSharp.Control.TaskSeq (>= 0.4.0)
- FSharp.Core (>= 9.0.100)
- FsToolkit.ErrorHandling (>= 4.18.0)
- Microsoft.Azure.Cosmos (>= 3.51.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.0 | 147 | 5/22/2025 |
## [1.0.0] - 2025-05-22
First release
[1.0.0]: https://github.com/fsprojects/FSharp.Azure.Cosmos/releases/tag/releases/1.0.0
### Added response discriminated unions for each Cosmos DB operation
They allow to handle all the relevant status codes which can be considered as errors instead of exceptions.
### Added computation expressions for all Cosmos DB operations
* Read
* ReadMany
* Create
* Replace
* Upsert
* Delete
* Patch
### Added computation expressions for unique key definition
### Added extension methods to execute operations defined with computation expressions
### Added extension methods to perform queries on Cosmos DB
* Create `IAsyncEnumerable` (`TaskSeq`) from a `FeedIterator`/`IQueryable`
* Provide `CancellationToken` to `TaskSeq` using `CancellableTaskSeq` module
[Unreleased]: https://github.com/fsprojects/FSharp.Azure.Cosmos/compare/releases/1.0.0...HEAD
[1.0.0]: https://github.com/fsprojects/FSharp.Azure.Cosmos/releases/tag/releases/1.0.0