I am a beginner to MongoDB and I'm playing around with it using the JAVA driver.
I have the following code
MongoClient client = new MongoClient();
DB d = client.getDB("world");
DBCollection c = d.getCollection("zips");
DBCursor cursor = c.find();
Now my question is that I want to use a simple cursor to go through the documents. The getDB() method is deprecated but it works fine. In the documentation it's mentioned that getDB can be replaced with MongoClient.getDatabase(); but getDatabase() returns a MongoDatabase not a DB.
Can someone point out the correct way to make a DBCursor without using any deprecated method. Thanks.
PS: I know there are frameworks like morphia, jongo etc but please keep them out of this discussion. I want to currently resort only to the JAVA driver. EDIT: The difference is about getting a cursor in the JAVA driver not between DB and MongoClient