Skip to content

Instantly share code, notes, and snippets.

@dj-nitehawk
dj-nitehawk / Program.cs
Last active Mar 9, 2020
aggregate - match > sort > group > replacewith
View Program.cs
using MongoDB.Driver;
using MongoDB.Entities;
using MongoDB.Entities.Core;
using System;
using System.Linq;
namespace StackOverFlow
{
public class Product : Entity
{
@dj-nitehawk
dj-nitehawk / Program.cs
Last active Mar 9, 2020
string template example - lookup pipeline
View Program.cs
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using MongoDB.Driver;
using MongoDB.Entities;
using MongoDB.Entities.Core;
using System.Linq;
namespace StackOverFlow
{
public class Channel : Entity
@dj-nitehawk
dj-nitehawk / Program.cs
Created Mar 12, 2020
update with aggregation pipeline stage
View Program.cs
using MongoDB.Entities;
using MongoDB.Entities.Core;
using System;
namespace StackOverFlow
{
public class UnitTravelHistory : Entity
{
public long JobDuration { get; set; }
public DateTime Start { get; set; }
@dj-nitehawk
dj-nitehawk / Program.cs
Last active Mar 13, 2020
filter by month number using aggregation pipeline
View Program.cs
using MongoDB.Driver;
using MongoDB.Entities;
using MongoDB.Entities.Core;
using System;
namespace StackOverFlow
{
public class Item : Entity
{
public DateTime DateOfCreation { get; set; }
@dj-nitehawk
dj-nitehawk / Program.cs
Created Mar 14, 2020
find query with filter > sort > limit > project
View Program.cs
using MongoDB.Entities;
using MongoDB.Entities.Core;
using System.Linq;
namespace StackOverFlow
{
public class Item : Entity
{
public int a { get; set; }
public int b { get; set; }
@dj-nitehawk
dj-nitehawk / Program.cs
Created Mar 16, 2020
find records that matches a nested array element
View Program.cs
using MongoDB.Entities;
using MongoDB.Entities.Core;
using System;
using System.Linq;
namespace StackOverFlow
{
public class AutoSave : Entity
{
public string[] Templates { get; set; }
@dj-nitehawk
dj-nitehawk / Program.cs
Created Mar 19, 2020
aggregation pipeline with multiple unwinds and replaceWith
View Program.cs
using MongoDB.Bson;
using MongoDB.Driver;
using MongoDB.Entities;
using MongoDB.Entities.Core;
using System.Linq;
namespace StackOverFlow
{
public class OptionMenu : Entity
{
@dj-nitehawk
dj-nitehawk / Program.cs
Last active Nov 13, 2020
one-to-many entity relationship example
View Program.cs
using MongoDB.Driver;
using MongoDB.Driver.Linq;
using MongoDB.Entities;
using System.Linq;
using System.Threading.Tasks;
namespace ReferencedRelationshipExample
{
public class Author : Entity
{
View Program.cs
using MongoDB.Entities;
using MongoDB.Entities.Core;
using System.Collections.Generic;
using System.Linq;
namespace TestApp
{
public class Zone : Entity
{
public int SqlId { get; set; }
@dj-nitehawk
dj-nitehawk / Program.cs
Created Jul 3, 2020
deeply nested shitstorm ;-)
View Program.cs
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using MongoDB.Driver;
using MongoDB.Entities;
using MongoDB.Entities.Core;
using System.Linq;
namespace TestApp
{
public class Team : Entity