This repository has been archived by the owner on Oct 21, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: resolve serialization errors in .NET examples (#37)
This ended up being a *slightly* bigger commit than I anticipated. But, I essentially did two things: - Annotate all `*Result` types in `Mondocks.Net/Types.fs` with `[<BsonIgnoreExtraElements>]`; otherwise, the .NET MongoDB Driver freaks out that the schema doesn't match exactly. - Avoid serializing each `Index` object in the `IndexBuilder`. When I first ran the example in `samples/Indexes`, it failed with this exception: ```sh Unhandled exception. MongoDB.Driver.MongoCommandException: Command createIndexes failed: BSON field 'createIndexes.indexes.0' is the wrong type 'string', expected type 'object'. ``` So we DON'T need the serialization step in the `IndexBuilder` anymore (though I kept the interface the same). Finally, I added a Nix flake with a very simple `devShell` because that's just what I'm used to developing with.
- Loading branch information
Showing
7 changed files
with
103 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -442,4 +442,7 @@ $RECYCLE.BIN/ | |
!.vscode/extensions.json | ||
|
||
*.fs.js | ||
*.mjs | ||
*.mjs | ||
|
||
# Direnv | ||
.envrc |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
inputs = { | ||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; | ||
flake-parts.url = "github:hercules-ci/flake-parts"; | ||
}; | ||
outputs = { self, nixpkgs, flake-parts }@inputs: | ||
flake-parts.lib.mkFlake { inherit inputs; } { | ||
perSystem = { system, pkgs, ... }: { | ||
# Basically "patches" the `pkgs` input to `perSystem` | ||
_module.args.pkgs = import inputs.nixpkgs { | ||
inherit system; | ||
config.allowUnfreePredicate = pkg: builtins.elem (nixpkgs.lib.getName pkg) [ "mongodb" "mongodb-compass" ]; | ||
}; | ||
formatter = pkgs.nixfmt; | ||
devShells.default = pkgs.mkShell { | ||
buildInputs = with pkgs; | ||
[ dotnet-sdk ]; | ||
shellHook = '' | ||
dotnet tool restore | ||
''; | ||
}; | ||
}; | ||
systems = [ "x86_64-linux" "x86_64-darwin" "aarch64-darwin" ]; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,4 +19,4 @@ | |
<ItemGroup> | ||
<ProjectReference Include="..\Mondocks\Mondocks.fsproj" /> | ||
</ItemGroup> | ||
</Project> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters