dev-mastery / comments-api

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

What's the point

wlopez-enkoding opened this issue · comments

const result = await db.collection('comments').find(query)

Hi man, first of all: thank you for your contribution for the community !

I was looking at this piece of code, and I don't understand why you import the DB and inside this code you use logic technology-specific... what's the point ?

I mean... If I need to change the data base I need to change makeDb origin, and ALSO this technology specific logic.

Am I right?

Thanks !

commented

You can easily use a proxy to implement an adapter pattern to those changes.
You can also use tools such which make the getting into the DB very similar to all query languages, such as NanoSql and even Prisma , making your changes minimal.

You can easily use a proxy to implement an adapter pattern to those changes.
You can also use tools such which make the getting into the DB very similar to all query languages, such as NanoSql and even Prisma , making your changes minimal.

Woooow both options look amazing ! Thank you !