go-bongo / bongo

Go ODM for MongoDB
MIT License
487 stars 40 forks source link

Populate sintax #26

Open oyepez003 opened 7 years ago

oyepez003 commented 7 years ago

Hi guys thanks for this project, it is amazing.

My Question is I can populate a child collection when the parent document has only ObjectId for relation.

Somthing like this:

type User struct { ... Address bson.ObjectId `bson:"address"` }

connection.Collection("user").Find(bson.M{"firstName":"Bob"}).Populate("messages")

Best regards.