1.

Which of the following method returns true if the cursor has documents?(a) hasMethod()(b) hasNext()(c) hasDoc()(d) all of the mentionedThe question was asked at a job interview.My question comes from Getting Started with MongoDB topic in portion MongoDB CRUD Concepts and Operation of MongoDB

Answer» CORRECT choice is (b) hasNext()

The best I can explain: hasNext() returns true if the CURSOR returned by the db.collection.find() QUERY can ITERATE further to return more DOCUMENTS.


Discussion

No Comment Found

Related InterviewSolutions