using MongoDB.Bson;
using MongoDB.Driver;
static MongoClient client = new MongoClient("mongodb://localhost:27017"); //Set the connection
string
static IMongoDatabase db =
client.GetDatabase("test"); //Database
name
public void ListOne(string age)
{
IMongoCollection<BsonDocument>
collection = db.GetCollection<BsonDocument>("user");
var
filter = Builders<BsonDocument>.Filter.Eq("age", age);
var
res = collection.Find(filter).ToList();
}
No comments:
Post a Comment