Luke101
Luke101

Reputation: 65278

How does MongoDB handle projection

I will have hundreds of fields in a document. If I only need one or two fields in a given document - does MongoDB transfer the whole document across the wire?

Upvotes: 0

Views: 71

Answers (1)

JohnnyHK
JohnnyHK

Reputation: 312035

Projection is handled server-side, so only the fields that are included in the query's projection will be transferred over the wire.

In the C# driver, this is accomplished via the SetFields method on MongoCursor.

Upvotes: 1

Related Questions