So I am fairly new to Drupal, having just been introduced to it by way of a job position. While looking through the documentation and learning the platform for work, I've decided to make use of it for a project I've had stewing for years. However, I need some advice on the best way to set things up data-wise before I start.

I'm planning to go with Drupal 7.x and hopefully will integrate MongoDB into the mix - the site I am going to build has pretty much all dynamic pages, users logging in and potentially a lot of queries. I figured it'd be best to integrate MongoDB in from the start to provide easier scalability in the future.

What I need advice on:
1. What's the best way to set up entities to optimize for future queries? I read somewhere that the properties should be kept few and the majority of the data should go into fields - is this true? What data is best to keep in the main entity table in properties as opposed to stored in fields with MongoDB?
2. Is there any benefit to having bundles or is it just as fine to have all entities? I keep thinking of bundles in the way of OOP inheritance - do bundles inherit properties from their parent entity?

And onto some examples of what I'm trying to do.

I plan to have Users owning/creating animals of different species.
Each species will have the same general fields - max/min weight, max-min height/length, gestation period, max offspring, scientific name, general information, etc.
Each animal can only be associated with one species, one species can have multiple animals.
Creating an animal may reference some information in that the species may have - weight and height range to choose a random value between mainly.
Viewing an animal would need information from the species (age of maturity, gestation period, etc.)
The rest of the information held in the species, though, wouldn't be accessed unless a user wanted to view statistics on the general species. Though there'd probably need to be a way to figure out how many animals of each species there are and so forth.

And one last question:
3. Any idea as to the best way to set this up using Entities? And what sort of information might be best kept in fields vs. properties? Should Species be its own entity, mayhaps, and there be some sort of EntityRelation between species and an Animal entity?

Any advice is appreciated - I want to make sure I get the best possible structure before starting.

Thanks,
- Kristen

Update:
I think I solved this myself with a lot more digging through Google searches and the like. I believe I'll make Species a vocabulary with all the different species a term - taxonomy terms are fieldable in 7.x and that should work perfectly. I can also associate them with each Animal, which I am still going to make an Entity. I've decided to keep only the link to the user and one or two other things in the actual main entity table in MySQL and field the rest so it can be used in MongoDB. :)

Comments

nevets’s picture

Why not simply use a content type (or types)? Your question seems to bypass a simpler solution.

livdera’s picture

Because, after reading through all the documentation I could find on the new entities, I figured it'd be a better path. I'd rather not re-purpose Nodes with Content Types - there's no need for the authored by, etc. properties. I don't mind a little extra work to get the custom entities - I just need advice on how best to set them up for query optimization in the future.

Repurposing nodes as content types seems to be the quick, easy and dirty solution. I'm hoping for a more custom structure and, as I said, I don't mind the extra work.

tygbiten’s picture

Thank you for providing the solution, really helpful. Can I ask though - was choosing to go with most of the variables in fields and not making them properties a performance issue alone? I'm having the same question myself, wondering if I should or shouldn't make properties out of my fields. What are the pros and cons of the two solutions?