My Image My Image

Ask me anything

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

Preffered 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.

Write Your Comments or Explanations to Help Others