Question: So I have a field called 'city' in my results...the results are corrupted, some times it's an actual name, sometimes it's a number. The following code displays all the records...

```
db.zips.aggregate([{$project : {city:{$substr:["$city",0,1]}}},{$sort : {city : 1}} ])

```

I need to modify this line to display only the records with a city who has a name that is a number (2,3,4, etc)....I think I can use '$match', but how?

```
db.zips.aggregate([{$project : {city:{$substr:["$city",0,1]}}},{$sort : {city : 1}}, {$match:{???what_to_say_here???} ]) 

```

How to say 'match when city is a number'?

the out put I get looks like this...

```
    {
        "city" : "A",
        "_id" : "04465"
    },
    {
        "city" : "1",
        "_id" : "02821"
    },
    {
        "city" : "0",
        "_id" : "04689"
    }

```

I'm trying to display only the records with a numeric string...this is related to a larger "homework" problem but I can't even get to the actual homework question until I get past this point.

Answer: 
Simply use:

```
db.zips.aggregate([
{$match: {
    'city': { $regex: '^[0-9].*'}
}}])

```

This work fine for me!
```
db.zips.aggregate([
    {$project : {city:{$substr:["$city",0,1]},pop:1}},
    {$group:{_id:"$city",sumPop:{$sum:"$pop"}}},
    {$sort : {_id : 1}}, 
    {$match:{_id : {$regex:/\d/}} },
    {$group:{_id:"id",sumPop:{$sum:"$sumPop"}}},
]);

```