I have created a logger in Node.js using the winston module and added MongoDB transport by requiring winston-mongodb module with the following options:
{
db: config.db[k.DB_ENV.AUTHOR],
username: config.dbUser,
password: config.dbPassword,
collection: 'log-aggregation',
storeHost: true,
capped: true,
cappedMax: 10 // documents
}
I expect the logger to create a new collection for every 10 documents. But the logger continue logging in the same collection. I commented the collection: 'log-aggregation'
line to check if the options are really working and then it began to log to the default 'log'
collection.
So where is my mistake? Is there a minimum no of document size to the cappedMax
option? I tried this with cappedSize
option also with 10 to 1000 values, still the new collections are not created.
I want to know the minimum and maximum permissible value for cappedSize and cappedMax option?
I also want to know what will be the name of new collections created?