E
E
enchikiben2014-08-16 09:26:17
MongoDB
enchikiben, 2014-08-16 09:26:17

Query in mongodb (join how to be)?

Good afternoon!
There is a collection of users (id, user, city) and a collection of user logs (id, uid, log).
How to select logs specific user filtered by city. Joinnov, as I understand it, is not in mongo. You can of course select users first and then select logs. but in php you don't want to keep an array of 2000 elements in memory. How to do it at the base level?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey, 2014-08-16
Protko @Fesor

In general, if you have such a situation, then your database is incorrectly designed.
It is possible to form a collection-aggregate through map/reduce and pull it.

Z
zed, 2014-08-16
@zedxxx

How to do it at the base level?

No way. And the fact that there are no joins and you will need to somehow take data from the database, you had to think at the design stage of the database, and not after.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question