Created
March 16, 2020 13:09
-
-
Save dj-nitehawk/5d36e976ef3b1e5f598947b0b34aa279 to your computer and use it in GitHub Desktop.
find records that matches a nested array element
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
using MongoDB.Entities; | |
using MongoDB.Entities.Core; | |
using System; | |
using System.Linq; | |
namespace StackOverFlow | |
{ | |
public class AutoSave : Entity | |
{ | |
public string[] Templates { get; set; } | |
} | |
public static class Program | |
{ | |
private static void Main() | |
{ | |
new DB("test", "localhost"); | |
var guids = new[] { | |
Guid.NewGuid().ToString(), | |
Guid.NewGuid().ToString() | |
}; | |
new AutoSave { Templates = guids }.Save(); | |
var result = DB.Queryable<AutoSave>() | |
.Where(s => s.Templates.Contains(guids[1])) | |
.ToList(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment