Files
freeCodeCamp/curriculum/challenges/russian/05-apis-and-microservices/mongodb-and-mongoose/use-model.find-to-search-your-data.russian.md
2019-05-06 13:40:24 +09:00

43 lines
1.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
id: 587d7fb7367417b2b2512c0b
title: Use model.find() to Search Your Database
localeTitle: Используйте model.find () для поиска в вашей базе данных
challengeType: 2
---
## Description
<section id='description'>
Найдите всех людей с данным именем, используя Model.find () -&gt; [Person]
В простейшем случае Model.find () принимает документ запроса (объект JSON) в качестве первого аргумента, а затем обратный вызов. Возвращает массив совпадений. Он поддерживает чрезвычайно широкий спектр параметров поиска. Проверьте это в документах. Используйте аргумент функции personName в качестве ключа поиска.
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: Найти все элементы, соответствующие критериям, должны быть успешными
testString: 'getUserInput => $.post(getUserInput(''url'') + ''/_api/find-all-by-name'', {name: ''r@nd0mN4m3'', age: 24, favoriteFoods: [''pizza'']}).then(data => { assert.isArray(data, ''the response should be an Array''); assert.equal(data[0].name, ''r@nd0mN4m3'', ''item.name is not what expected''); assert.equal(data[0].__v, 0, ''The item should be not previously edited''); }, xhr => { throw new Error(xhr.responseText); })'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>