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