1
I’m using the Mongodb Atlas with bank,and the Mongodbdriver to make the connection, but when selecting my Collection it returns empty instead of returning the collection data.
My connection:
class Program
{
static void Main(string[] args)
{
var connectionString = "mongodb+srv://<meu_usuario>:<minha_senha>@cluster0-kuyah.mongodb.net/test?retryWrites=true";
var client = new MongoClient(connectionString);
var users = client.GetDatabase("WebApi").GetCollection<User>("usuario");
var resultado = users.Find(new BsonDocument()).ToListAsync();
}
}
My Model
public class User
{
[BsonId]
public ObjectId Id { get; set; }
[BsonElement("nome")]
public string Nome { get; set; }
[BsonElement("password")]
public string password { get; set; }
}