loresoft / NLog.Mongo

MongoDB Target for NLog
MIT License
66 stars 34 forks source link

On missing collection create not capped collection #157

Closed Tulpash closed 2 months ago

Tulpash commented 2 months ago

Collection created by target is not capped

<target xsi:type="Mongo"
    name="mongo"
    connectionString="${configsetting:name=logger.connection}"
    databaseName="${configsetting:name=logger.database}"
    collectionName="${configsetting:name=logger.collection}"
    cappedCollectionSize="26214400"
    includeDefaults="false"
    includeEventProperties="false">     
  <field name="date" layout="${date}" bsonType="DateTime" />
  <field name="level" layout="${level}" />
  <field name="message" layout="${message}" />
  <field name="logger" layout="${logger}" />
  <field name="exception_message" layout="${exception:format=Message}" />
  <field name="exception_type" layout="${exception:format=Type}" />
  <field name="exception_trace" layout="${exception:format=StackTrace}" />
</target>

Result in mongosh image

MongoDB: 7.0.14 Target: 4.7.2 NLog: 5.3.3