Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void Main(string[] args)
- {
- var connectionString = "connection string";
- var url = MongoUrl.Create(connectionString);
- var database = new MongoClient(connectionString).GetDatabase(url.DatabaseName);
- var collection = database.GetCollection<BridgeGameStateDocument>("bridge_games_states");
- while (true)
- {
- Console.WriteLine("Enter _id:");
- var id = Console.ReadLine().Trim();
- var filter = new BsonDocument("_id", id);
- var filter2 = Builders<BridgeGameStateDocument>.Filter.Eq(e => e.Id, id);
- var doc = collection.Find(filter2).FirstOrDefault();
- Console.WriteLine("Success " + doc.Id);
- }
- }
- public class BridgeGameStateDocument
- {
- [BsonId]
- public string Id { get; set; }
- public string HostUserId { get; set; }
- public int? CompeteRound { get; set; }
- [BsonDateTimeOptions(Kind = DateTimeKind.Utc)]
- public DateTime Created { get; set; }
- [BsonDateTimeOptions(Kind = DateTimeKind.Utc)]
- public DateTime? Started { get; set; }
- [BsonDateTimeOptions(Kind = DateTimeKind.Utc)]
- public DateTime? Finished { get; set; }
- public string Vulnerable { get; set; }
- public string DealId { get; set; }
- [JsonConverter(typeof(StringEnumConverter))]
- [BsonRepresentation(BsonType.String)]
- public DealTypeEnum GameType { get; set; }
- [JsonConverter(typeof(StringEnumConverter))]
- [BsonRepresentation(BsonType.String)]
- public GameMode GameMode { get; set; }
- public string HostUserName { get; set; }
- public long BiddingDealNumber { get; set; }
- public string BoardNumber { get; set; }
- }
- public enum DealTypeEnum
- {
- Attack,
- Defence,
- Bidding,
- Compete,
- AttackEasy
- }
- public enum GameMode
- {
- PracticeAttackSets = 1,
- Ebook = 16,
- Bidding = 32,
- Compete = 64,
- PlayEasy = 128
- }
Add Comment
Please, Sign In to add comment