MongoDB Cursor Example
In this example, we are working with:
Database: gfg
Collection: student
Documents: Three documents contain the details of the students
Here, we use the following query to display all the documents present in the student collection
db.student.find().pretty()
This find() method returns a cursor containing all documents present in the student collection.
MongoDB Cursor
The MongoDB cursor is a pointer that references the documents of the collection returned by the find() method.
The cursor is used to access the documents. By default, the cursor iterates automatically, but can also be iterated manually by the user.
Contact Us