Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于this.AddProperties(bsonDocument, logEvent);内部方法问题 #15

Open
wheeky opened this issue Nov 18, 2017 · 0 comments
Open

关于this.AddProperties(bsonDocument, logEvent);内部方法问题 #15

wheeky opened this issue Nov 18, 2017 · 0 comments

Comments

@wheeky
Copy link

wheeky commented Nov 18, 2017

private BsonDocument CreateDocument(LogEventInfo logEvent) { BsonDocument bsonDocument = new BsonDocument(); if (this.IncludeDefaults || this.Fields.Count == 0) { this.AddDefaults(bsonDocument, logEvent); } foreach (MongoField current in this.Fields) { BsonValue value = this.GetValue(current, logEvent); if (value != null) { bsonDocument.set_Item(current.Name, value); } } this.AddProperties(bsonDocument, logEvent); return bsonDocument; }
这个方法能否设为虚方法,以便通过继承重写满足不同的插入到MONGO DB的字段格式,目前当我想把自定义字段加入到mongoDB中时,发现this.AddProperties(bsonDocument, logEvent);会把mongoTarget.Properties与eventInfo.Properties的字段都插入到mongoDB中,eventInfo.Properties存在于mongoDB的Properties键对面对应的字段,如果想输出自定义字段,那么则会造成mongoDB中的字段与Properties键对面对应的字段存在重复字段的情况,需要改善

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant