Skip to content

Instantly share code, notes, and snippets.

@egoson
Last active August 25, 2021 05:47
Show Gist options
  • Select an option

  • Save egoson/c339612f806a7111c130dcb8990f19ff to your computer and use it in GitHub Desktop.

Select an option

Save egoson/c339612f806a7111c130dcb8990f19ff to your computer and use it in GitHub Desktop.
MONGODB
user: [
{
id: 1,
name: 'Michel',
},
{
id: 2,
name: 'Peter',
},
{
id: 3,
name: 'Helen',
}
]
book: [
{
id: 1,
name: 'Book 1',
ownerId: 1,
color: 'red'
},
{
id: 2,
name: 'Book 2',
ownerId: 2,
color: 'red'
},
{
id: 3,
name: 'Book 3',
ownerId: 2,
color: 'blue'
},
]
filter: {
where: {
// нужно найти всех пользователей у которых есть книги красного цвета.
// То есть запрос должен вывести пользователя с id 1 и книгу с id 1
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment