Ejemplo n.º 1
0
        public MongoPasswordData(string connectionString)
        {
            MongoClient       = new MongoClient(connectionString);
            ContextDatabase   = MongoClient.GetDatabase(_contextDatabase);
            ContextCollection = ContextDatabase.GetCollection <BsonDocument>(_contextColection);
            List <BsonDocument> documents = ContextCollection.Find(new BsonDocument()).ToList();

            if (documents.Count > 0)
            {
                foreach (BsonDocument doc in documents)
                {
                    passwords.Add(BsonSerializer.Deserialize <Password>(doc));
                }
            }
        }