Skip to content

Instantly share code, notes, and snippets.

@sindbach
sindbach / Program.cs
Last active April 15, 2020 10:35
MongoDB .NET/C# Polymorphism BsonKnownTypes
using System;
using MongoDB.Bson;
using MongoDB.Driver;
using MongoDB.Bson.Serialization;
using MongoDB.Bson.Serialization.Serializers;
using MongoDB.Bson.Serialization.Attributes;
using System.Collections.Generic;
namespace Application
{
@sindbach
sindbach / aggregation.js
Last active June 19, 2020 23:38
Compare two object documents in MongoDB 4.4 with $function aggregation pipeline
/*
Outputs:
{
"_id": ObjectId("5eec4fd0aee4bf9d2e209e2d"),
"diff": {
"haveMore": {
"foo2": null
},
"types": {
"differentType": NumberLong("55"),