yiisoft / db

Yii Database Library
https://www.yiiframework.com/
BSD 3-Clause "New" or "Revised" License
134 stars 35 forks source link

NoSQL databases (particularly MongoDB) #715

Open luislobo opened 1 year ago

luislobo commented 1 year ago

Is this package supposed to be the base to build NoSQL implementations?

MongoDB has basic primitives that match most SQL use cases (although heavy use of aggregations might be needed in some "advanced" cases).

Should there be a separate yiisoft/object-db? I can see it having a close mapping to what an ActiveRecord is....

samdark commented 1 year ago

I'm still not sure if it is a good idea to do that. It was like this in Yii2 but whole AR was modelled based on MySQL so majority of MongoDB features were not used.

luislobo commented 1 year ago

Yeah. Nowadays, MongoDB supports transactions (https://www.mongodb.com/docs/manual/core/transactions/) , multiple CRUD alternatives (insertOne/Many, updateOne/Many, deleteOne/Many, etc https://www.mongodb.com/docs/manual/crud/), only thing is doing "JOIN" operations: you need to do aggregations with $lookup (far more complicated that what I'd love, and $lookup usage depends on the MongoDB version, being the latest the most flexible one).

BUT, a person with enough motivation could make it happen :)

xepozz commented 1 year ago

BUT, a person with enough motivation could make it happen :)

Isn't it you? ;)

luislobo commented 1 year ago

I could, but I haven't used Yii in production for years (worked in Node.js for the last 9). I do have a lot of experience with MongoDB.

I'd need guidance on how to start building it for Yii 3... if I had a base project.

xepozz commented 1 year ago

We have https://github.com/yiisoft/demo, so you can use it as a temporary project.

If you have questions/problems you may ask them directly in telegram chat, instead of creating issues for each one.

https://t.me/yii3en

But general question is do we really need to combine two different database approaches into the one? It's nice to have similar api to work with any databases, but in addition it brings lots problems/overrides/incompatibles. Isn't it?