Server projection with MongoDB driver C # 2.0

I have a set of documents with a few small properties and one huge property (binary 10 megabyte PDF document). I am using the latest stable C # driver published on 2015-04-02. Is there a way to get a list of these documents with all the small properties, but excluding a huge binary?

+5
source share
1 answer

You want to use IFindFluent.Find , and then use IFindFluent.Projection and Builders.Projection.Exclude to exclude this property:

 var query = collection. Find(filter). Project<Document>(Builders<Document>.Projection.Exclude(doc => doc.HugeBlob)); var results = await query.ToListAsync(); 
+4
source

All Articles