How to retrieve a subset of fields using the C# MongoDB driver? -


i've searched world on , can't seem find answer this.

how do in c#:

// retrieve ssn field documents last_name == 'smith': db.users.find({last_name: 'smith'}, {'ssn': 1}); 

thanks!

note can use (type/refactoring)-safe version:

userscollection.findallas<user>()                .setfields(fields<user>.include(user => user.firstname,                                                user => user.lastname)                                       .exclude(user => user.ssn)                .toarray(); 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -