Skip to content
This repository has been archived by the owner on Oct 21, 2024. It is now read-only.

fix: resolve serialization errors in .NET examples #37

Merged
merged 1 commit into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"fantomas": {
"version": "5.1.3",
"version": "6.2.1",
"commands": [
"fantomas"
]
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -442,4 +442,7 @@ $RECYCLE.BIN/
!.vscode/extensions.json

*.fs.js
*.mjs
*.mjs

# Direnv
.envrc
64 changes: 64 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions flake.nix
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" ];
};
}
2 changes: 1 addition & 1 deletion src/Mondocks.Net/Mondocks.Net.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@
<ItemGroup>
<ProjectReference Include="..\Mondocks\Mondocks.fsproj" />
</ItemGroup>
</Project>
</Project>
7 changes: 7 additions & 0 deletions src/Mondocks.Net/Types.fs
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
namespace Mondocks.Types

open MongoDB.Bson
open MongoDB.Bson.Serialization.Attributes

[<BsonIgnoreExtraElements>]
type Cursor<'T> = { firstBatch: seq<'T>; ns: string }

[<BsonIgnoreExtraElements>]
type FindResult<'T> = { cursor: Cursor<'T>; ok: float }

[<BsonIgnoreExtraElements>]
type InsertResult = { n: int; ok: float }

[<BsonIgnoreExtraElements>]
type UpdateResult = { n: int; nModified: int; ok: float }

[<BsonIgnoreExtraElements>]
type DeleteResult = { n: int; ok: float }

[<BsonIgnoreExtraElements>]
type CreateIndexResult =
Expand Down
2 changes: 1 addition & 1 deletion src/Mondocks/Database.fs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ type IndexBuilder(name: string, serialize: SerializerFn) =
wildcardProjection = None }

member inline this.Run(state: Index<'PartialFilterExpression, 'StorageEngine, 'Weights, 'WildcardProjection>) =
this.Serialize { state with name = this.Name }
{ state with name = this.Name }

[<CustomOperation("key")>]
member inline __.Key
Expand Down