如何显示总编号查询到mongoDB中的记录和实际记录数?

时间:2019-01-24 12:18:56

标签: mongodb mongodb-query

如何在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 }

这里我只有6条记录,但是如果在显示时我有记录的末尾数字,我们如何确定文件总数?我应该滚动到最后一条记录进行计数吗? 还是有更好的方法?

0 个答案:

没有答案