-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support to mongodb driver #123
base: main
Are you sure you want to change the base?
Conversation
Since Backpack itself has unofficial support for MongoDB... yeah... I guess we should do this 😀 I just want it written down in history that once again we have to litter our code with conditionals for MongoDB... but yeah... I don't see any way around this... thank you @promatik . I don't have a way to test this right now so let's please ask @MeerKatDev and/or @pxpm to give this a go, so we can merge it. Cheers! |
I would avoid setting this |
@MeerKatDev great suggestion 👌 Anyway @MeerKatDev, would you prefer to not have the base Model changed and change it manually? |
I think it's ok to keep it changed, because as of now and I think in the near future, that package is the standard for using mongodb |
This package will be rafactored/rewritten in a few months, so I don't think it's worth adding a config file for it. That file would be shortlived anyway. Plus, I bet 6 months from now I think this PR is ok as it is (all things considered 😅). I'm just waiting for at least one more person to test this and give a thumbs up, and I'll merge it. Cheers! |
Ok, so one other thing I noticed is that there is no casting support. When I normally work with Laravel and MongoDB, objects need to be kept objects, because Laravel converts them to string automatically, and same goes for dates - they should be saved as |
so-how do i make this work? same issue, and im not seeing any resolution here as to what was done or what needs to be done to make it work with mongodb.... |
@skylarr1227 you can use this PR as I've just merged master here so everything is up-to-date with current version, plus this fixes. I am not a MongoDB user myself, I am concerned I didn't fully understand MongoDB concepts to confidently say this 100% works. It seems to work, I've tested this PR and it allow to generate without the errors .. but I didn't fully understood some requirements mentioned here. If you give this branch a go, and this works as you expect, please let us know, maybe it help us to merge this into core with more confidence. Cheers |
Absolutely, ill try this later tonight when i get home. Sorry i missed you asking <3. |
It's already been ages since this was put up (welp PR from 2021, last comment 2022) but hey. Here comes another tester! Other than that the created Model is completely empty ofc and theres nothing to see on the crud. |
Hey @ShuriZma thanks for the feedback. We don't "officially" support mongodb, but we aim to have non-blockers or solutions if people want to use it with mongo. AFAIK it works, at least from my simple tests. Working on this kind of stuff is time consuming. I don't think it makes sense having mentions of mongodb and other engines that we don't "officially" support, and making sure that the crud functions work too. What I would probably do here was just to either: I would probably go with option b). As you can see as of today there are already changes related to Sorry this haven't been prioritized, and I don't think this will be in a near future, I just don't wanted to let you without an answer. So here goes, my proposed solution for people that need this stubs at the moment is to publish the backpack stubs and change them accordingly to your needs If you use them in multiple projects you can put them in a package that requires generators and has the views changed, then instead of requiring If someone puts this in a package more people could benefit from it, if it's maintained we can promote it as our "recommended solution for mongo users". Cheers |
Fix for Laravel-Backpack/CRUD#4000.
This adds support to MongoDB databases.