A
A
Alexander Wolf2014-04-18 14:55:00
MongoDB
Alexander Wolf, 2014-04-18 14:55:00

How to make a fetch in mongodb?

Hello! I have a collection in mongodb. All documents there are built according to the model (mongoose).
Code:

{
  _id: ObjectId,
  name: String,
  shop: ObjectId
}

shop:
{
  _id: ObjectId,
  name: String
}

I need to select multiple records from a collection of shops, sorted by the number of codes that refer to that shop (via the codes->shop field).

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
anyd3v, 2014-04-18
@mannaro

It's nosql. you cannot join in it.
In this case, a counter is created in the Shop, which is increased or decreased at the time of adding or deleting Code.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question