MongoDB Find the Maximum Value Why Is null

  mongodb, question

The database looks something like this:

{
 "_id" : ObjectId("57d248bd43be573cb0530d00"),
 "url" : "www.baidu.com",
 "shorterUrlNum" : 1
 }
 
 /* 2 */
 {
 "_id" : ObjectId("57d248d843be573cb0530d01"),
 "url" : "www.baidu.com",
 "shorterUrlNum" : 1
 }
 
 /* 3 */
 {
 "_id" : ObjectId("57d2490d01ddf93cb4723f8b"),
 "url" : "www.baidu.com",
 "shorterUrlNum" : 1
 }
 
 /* 4 */
 {
 "_id" : ObjectId("57d24ad4a8305e3cc9851d6d"),
 "url" : "www.baidu.com",
 "shorterUrlNum" : 1
 }

Use command

db.getCollection('sites').aggregate([
 {
 $group: {
 _id: 'max',
 max: {'$max': '$shorterUrl'}
 }
 }])

Why is null the maximum value?

{
 "_id" : "max",
 "max" : null
 }

There is nothing in your document at all.$shorterUrlThis field.