$lookup v.s having duplicate info in two collections

Hi,

My system’s user management module has an organization collection and a user collection. The user collection is frequently queries by my frontend to validate if the user has proper access to frontend features. The organization collection is rarely changed by our users.

I am wondering whether I should having some organization info duplicately stored in the user collections like “OrgDisplayName” and “OrgRole” to avoid calling $lookup frequently. For a SQL database, I will definitely avoid this and use the SQL Joins. But I don’t know whether $lookup has very high cost in MongoDB such as latency and database capacity.

Thanks!

type Organization struct {
	Id          primitive.ObjectID `bson:"_id,omitempty"`
	DisplayName string             `bson:"display_name,omitempty"`
	Admins      []string           `bson:"admins,omitempty"`
	Users       []string           `bson:"users,omitempty"`
}

type User struct {
	Id                primitive.ObjectID   `bson:"_id,omitempty"`
	OrgId             primitive.ObjectID   `bson:"org_id,omitempty"`
	OrgDisplayName    string               `bson:"org_display_name,omitempty"`
	OrgRole           string               `bson:"org_role,omitempty"`
}

Bumping up.

Some online discussion seems to agree with this idea, like https://www.quora.com/Is-it-ok-to-duplicate-data-in-a-NoSQL-database-I-would-appreciate-any-detailed-answer.

Maybe we should evaluate $lookup latency after creating indexes on these fields.