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
Post a Comment