Jeffrey Chen
Jeffrey Chen

Reputation: 1059

How to use mongoose-joins for Node.js

I am trying to figure out how to use mongoose-joins for Node.js. I have tried looking at the ReadMe file, it only explains how set it up. Is there any sample code for actually joining two collections of data?

Upvotes: 5

Views: 1754

Answers (1)

StevenLooman
StevenLooman

Reputation: 381

Maybe DBRefs provide enough functionality for you. These are standard in the current release of Mongoose (2.4.10 as of this writing.)

With a DBRef, you can point to another document, and let Mongoose retrieve that document for you and 'link' it to the instance of the current document.

If you need more elaborate join-functionality, the mongoose-joins is probably the way to go.

Upvotes: 3

Related Questions