Giter Site home page Giter Site logo

Comments (3)

yurijmikhalevich avatar yurijmikhalevich commented on September 23, 2024

Thank you for your code, I will review it later.

Have you tried to run this test https://github.com/winstonjs/winston-mongodb/blob/master/test/winston-mongodb-preconnected-test.js?

from winston-mongodb.

dankahle avatar dankahle commented on September 23, 2024

No I haven't sorry, but it falls short in this case as if it would go one step further (log), then the log would probably find that sweetspot where winston-mongodb was authorizing/creatingcollection while the log was trying to happen. Something goes wrong there, but no surprise, as you probably shouldn't try to authrorize while your writing on the same connection. Yesterday I put in my fixes, the promise fix I had talked about and the other one I talk about above, and worked like a charm. I thought between the promise fix and mongoose, I would just require the db and logger and no more async module waiting, but sadly the mongoose underlying native driver didn't store the logs for some reason, so not quite the same as just opening a native driver. The answer of course is to have winston-mongodb take a mongoose connection as well, but then there's that whole authorization thing... I don't understand that. I.e. if you have a db connection, they the auth has already been done, why redo it? If that wasn't there, you could plug mongoose in and just use it as if the db was ready, mongoose queueing the db commands for you. With the native driver, all works just fine with the promise, which is yet another option. Then at least all modules requiring a logger need not do anything special, the logger simply queueing logs until its ready as it does for the connection string option.

from winston-mongodb.

dankahle avatar dankahle commented on September 23, 2024

Was gonna do a quick PR of my changes, but can't make any sense of the tests. Look like they're there just to add to winston's test suite, but can't see how they would even plug in, or how they would be asserted as well. I'll just PR my changes so you can see what I was thinking.

from winston-mongodb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.