How to display the total number of records and actual records in a single query in MongoDB?
> db.Test.count();
6
> db.Test.find();
{ "_id" : 112, "User_Name" : "Sachin Tendulkar", "Date_Of_Join" : ISODate("2018-03-04T00:00:00Z"), "Education" : [ "10th", "Ph.D" ], "Hobby" : [ "Cricket" ], "Job_Category" : [ "Coach" ], "Gender" : "Male", "Salary" : "$90000", "new" : 1, "IND_Salary" : 500 }
{ "_id" : ObjectId("5c4882b5a28e9a1617ea4fe1"), "Salary" : 5000, "new" : 1, "IND_Salary" : 500 }
{ "_id" : ObjectId("5c4882b9a28e9a1617ea4fe2"), "Salary" : 500, "new" : 1, "IND_Salary" : 500 }
{ "_id" : ObjectId("5c4973694d9171f5a5425760"), "Salary" : 6000, "new" : 1, "IND_Salary" : 500 }
{ "_id" : ObjectId("5c4973714d9171f5a5425761"), "Salary" : 4000, "new" : 1, "IND_Salary" : 500 }
{ "_id" : ObjectId("5c49737b4d9171f5a5425762"), "Salary" : 4500, "new" : 1, "IND_Salary" : 500 }
Here I have only 6 records but if I have end nuber of records while display how can we identify the total amount of documents? Should I scroll to last records for counting? Or is there any better way?