Mongoclient returns empty when selecting a Collection

Asked

Viewed 45 times

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; }
    }
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.