MongoDB I want to group statistical arrays, and then the condition is the time region, how to achieve

I want to group statistical arrays, and then the condition is the time region, how to achieve

// 
// [Error] A pipeline stage specification object must contain exactly one field. at line 1, column 1
db.getCollection("user_reg").aggregate([
    {
        "$group": {
            _id: "$isfrom",
            count: {
                "$sum": 1
            },
        },
        "$match": {
            "regtime": {
                "$gte": "2000-01-01",
                "$lte": "2020-01-01"
            }
        }
    }
]) 
May.26,2022

I don't know what the raw data looks like, but generally speaking, you should filter before grouping. At the same time, there should be only one operator ($match/$group, etc.) in an array element:

db.getCollection("user_reg").aggregate([
    {
        "$match": {
            "regtime": {
                "$gte": '2000-01-01',
                "$lte": '2020-01-01'
            }
        }
    },
    {
        "$group": {
            _id: "$isfrom",
            count: {
                "$sum": 1
            },
        }
    }
])
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1bfd361-3236e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1bfd361-3236e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?