> For the complete documentation index, see [llms.txt](https://janeto.gitbook.io/mongodb-toan-tap/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://janeto.gitbook.io/mongodb-toan-tap/truy-van-document-trong-mongodb/and-trong-mongodb.md).

# AND trong MongoDB

## Cú pháp <a href="#c-ph-p" id="c-ph-p"></a>

Trong phương thức find(), nếu bạn truyền nhiều key bằng cách phân biệt chúng bởi dấu phảy (,), thì MongoDB xem nó như là điều kiện **AND**. Cú pháp cơ bản của AND trong MongoDB như sau:

```
>db.mycol.find({key1:value1, key2:value2}).pretty()
```

## Ví dụ <a href="#v-d" id="v-d"></a>

Ví dụ sau hiển thị tất cả loạt bài hướng dẫn (tutorials) được viết bởi 'tutorials point' có title là 'MongoDB Overview'

```
>db.mycol.find({"by":"tutorials point","title": "MongoDB Overview"}).pretty()
{

"_id": ObjectId(7df78ad8902c),

"title": "MongoDB Overview",

"description": "MongoDB is no sql database",

"by": "tutorials point",

"url": "http://www.tutorialspoint.com",

"tags": ["mongodb", "database", "NoSQL"],

"likes": "100"

}

>
```

Mệnh đề WHERE tương đương với ví dụ trên sẽ là **' where by='tutorials point' AND title='MongoDB Overview' '**. Bạn có thể truyền bất kỳ số cặp key-value nào trong mệnh đề find.
