Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

harryg's avatar

NoSQL in Laravel

I've recently been exploring ways to attach multiple properties to a model in an EAV pattern, much like how WordPress uses custom fields for posts for example.

It struck me that the EAV pattern is essentially trying to replicate the behaviour of a NoSQL database like MongoDB etc within a defined schema.

Jeff, could you possibly do a mini-series on using a NoSQL database with Laravel? I am aware there are some packages that add support to Eloquent. A simple example project (like having custom fields for posts for instance) would help, especially for the many of us here who have little to no knowledge of NoSQL databases and how they're applied.

0 likes
64 replies
billmurrin's avatar

I would like to see a video series using Elastic Search as the back-end.

16 likes
uno's avatar

+1 or Parse as back-end which uses MongoDB

2 likes
JeffreyWay's avatar

@jlrdw - You come off pretty harsh sometimes on these forums. I don't like deleting comments, so tone it down a bit, please. :) We're all trying to learn here.

21 likes
jlrdw's avatar

@JeffreyWay will do, but could you explain in more detail about MongoDb?
Edit: I know I get a little impatient at times, one side of me used to work on B 52's and I guess that side gets a little arrogant. And there's the other side that sometimes forgets that I was new at one time to and I had to learn all this from somewhere. Thanks for reminding me.

harryg's avatar

@jlrdw I'm not an expert at this but surely NoSQL must have some difference or it wouldn't exist - even with an active record abstraction. As I understand it it could allow one to have more flexible models as the database is less reliant on a schema. I.e. you can give your models attributes that don't exist in the table schema without having to change migrations.

I see there's a MongoDB package out there. It would be nice to see it in action and the basics of deploying a mongodb database.

Perhaps there's not enough here to justify a video but I thought it could be of interest. No worries either way.

4 likes
tristanbailey's avatar

+1 for mongo and also +1 for Elastic, now that we are thinking of services and best use case rather than just LAMP-code-stop, I think using these other db services makes sense. Mongo (nosql in general) can be great for building something out when you dont want to first take the time to structure the data. Then review and pull out structure later or maybe just leave it in a key-value / json store.

janderson's avatar

+1 CouchDB ~ I love CouchDB. I'm in disagreement with some of the comments about what these sorts of non-relational data-stores are useful for, or not. RDBMS have an important place in many systems, but aren't needed for all of them and don't excel at every possible type of task. There seems to be some very rigid dogmatic rhetoric on both sides of this discussion, I'd like to hear the Laracasts take on it. "NoSQL" wouldn't be "a thing" if there wasn't a need.

2 likes
alenn's avatar

The best thing about MongoDB (in my opinion) is that I don't have to create migrations to add new fields in database, I just put $user->new_field = "something" and it's there

1 like
Next

Please or to participate in this conversation.