E
E
Egor Knyazhev2016-12-02 18:59:35
NoSQL
Egor Knyazhev, 2016-12-02 18:59:35

Do I need to store links (id) to child documents in mongodb?

There are two documents in the database: people and doc. doc is always owned by people.
In doc I create the owner (id) field, similarly in people there is an array docs for storing document id.
Does it make sense for people to have an array with id docs? Will the find query be faster by _id (passing an array of IDs) than by owner? If neither is right, then what is right?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Puma Thailand, 2016-12-02
@opium

The first option is correct

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question