У меня есть коллекция под названием Notification, которая имеет:
- _id: строка (пользовательское значение идентификатора, не сгенерированное системой)
- _class: строка
- _content: строка
Она запускается, однако достигает счетчика и выходит из функции, и я не могу сказать, что она делает.
using MongoDB.Bson.Serialization.Attributes;
using System;
namespace DataMover
{
public class Notification
{
[BsonId]
public string Id { get; set; }
public string _class { get; set; }
public string content { get; set; }
}
}
using MongoDB.Driver;
using System.Threading.Tasks;
private async Task LookupNotification(string id)
{
MongoClient client = new MongoClient("mongodb://server:27017");
IMongoCollection notificationContent = client.GetDatabase("notifications").GetCollection("notification_contents");
var filter = Builders.Filter.Eq(doc => doc.Id, id);
var count = notificationContent.CountDocuments(filter);
MessageBox.Show(count.ToString());
return true;
}
Подробнее здесь: https://stackoverflow.com/questions/798 ... ng-c-sharp
Мобильная версия