Articles → MONGODB → Cursor In Mongodb

Cursor In Mongodb






What Is A Cursor?





Example




Picture showing executing the find method in MongoDB




Picture showing the text type it for more once find method is executed





Assigning Cursor Object To A Variable




Picture showing assigning the cursor to the variable



Next And Hasnext Method




Picture showing the output of next method in cursor




Picture showing the output of hasNext method in cursor



Loop Through The Cursor




cursor.forEach(doc=>{printjson(doc)})



Posted By  -  Karan Gupta
 
Posted On  -  Tuesday, February 28, 2023
 
Updated On  -  Tuesday, March 26, 2024

Query/Feedback


Your Email Id
 
Subject
 
Query/FeedbackCharacters remaining 250