Translating natural language questions into MongoDB queries is critical for flexible data access in current NoSQL systems. However, semantic ambiguity in user questions and the dynamic schema of MongoDB make this work tough. This study presents QMQL (Question to Mongo Query Language), a hybrid approach meant to address these challenges. QMQL combines a Graph Attention Network (GAT) for refining schema elements with a Retrieval-Augmented Generation (RAG) mechanism that employs BERT embeddings to retrieve relevant schema and resolve semantic ambiguity. A T5-base model is used to generate a MongoDB query corresponding to the user’s question. An experimental evaluation on an extended dataset encompassing various real-world domains demonstrates the effectiveness of the proposed approach. QMQL achieves excellent performance with an EMA of 0.89, an EM of 0.91, and a BLEU score of 0.95, exceeding previous approaches, particularly for semantically ambiguous questions and sophisticated queries across flexible MongoDB schemas.
Copyrights © 2026