In the `sample_training` database, `companies` collection, there is data like the following one:

> 
> [![enter image description here](https://i.stack.imgur.com/u96p8.png)](https://i.stack.imgur.com/u96p8.png)
> 
> 
> 

**Exercise:** How many companies in the `sample_training.companies` collection have offices in the city of "*Seattle*"?

---

The query I thought of was with the dot notation as follows:

```
db.companies.find({ "offices.0.city": "Seattle" }).count()

```

This returns `110`.

However, the site gives the following query as the correct one

```
db.companies.find({ "offices": { "$elemMatch": { "city": "Seattle" } } }).count()

```

This returns `117`.

---

I have checked that my query seems to work fine as well, but I don't know why they differ in their result.