Connection error with mongodb Atlas

I am new with this deployments and connections between servers and I deployed my app in netlify and my db in mongo atlas, from atlas I gave access to any ip (0.0.0.0.0/0) and I have no CORS problems, but still when I try to connect to the database I get a time out for connection, can someone tell me what I should check?
Taking into account that when I consume the db from localhost it returns me the data and inserts according to the operation, but when I deploy in netlify it does not connect anymore.