.net - Mongodb c# 2.0 driver doesn't ignore extra elements -


i'm using 2.0 mongodb c# driver.
have 2 classes:

[bsonignoreextraelements] public class a{...}  [bsonignoreextraelements] public class b:a{...} 

this code:

public async task<list<a>> getlist(string x) {     var collection = db.getcollection<a>("mycollection");     var filter = builders<a>.filter.eq("fielda", x);     list<a> anslist = await collection.find(filter).tolistasync();      return anslist; } 

on computer works fine, reason on other computers function returns list<b> contains full objects saved in db. don't want expose fields users therefore must return list without class b's fields.


Comments

Popular posts from this blog

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -