LoRaWAN is an innovative and prominent communication protocol in the domain of Low Power Wide Area Network (LPWAN), known for its ability to provide long-range communication with low energy consumption. However, the practical implementation of the LoRaWAN protocol, operating at the Medium Access Control (MAC) layer and built upon the LoRa physical (PHY) layer, presents numerous research challenges, including network congestion, interference, optimal resource allocation, collisions, scalability, and security. To mitigate these challenges effectively, the adoption of cutting-edge data-driven technologies such as Deep Learning (DL) and Machine Learning (ML) emerges as a promising approach. Interestingly, very few existing survey or tutorial has addressed the importance of ML or DL-based techniques for LoRaWAN in its current state. This article provides a comprehensive survey of current LoRaWAN challenges and recent solutions, particularly using DL and ML algorithms. The primary objective of this survey is to stimulate further research efforts to enhance the performance of LoRa networks and facilitate their practical deployments. We start by providing a technical background to LoRa alliances, LoRa, and LoRaWAN. Furthermore, we discuss an overview of the most utilized DL and ML algorithms for overcoming LoRaWAN challenges. We also present an interoperable reference architecture for LoRaWAN and validate its effectiveness using a wide range of applications. Additionally, we shed light on several evolving challenges of LoRa and LoRaWAN for the future digital network, along with possible solutions. Finally, we conclude our discussion by briefly summarizing our work.