Skip to content
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

MENUS: Merge navigation.menus and navigation.items collections? #10

Closed
rdiaztushman opened this issue Dec 18, 2013 · 4 comments
Closed

Comments

@rdiaztushman
Copy link
Member

I can't think of a good reason to have two collections. navigation.menus is currently just the top-level items in navigation.items

@ChrisFrench
Copy link
Member

the way that I would think of a mongo menu system would work would me there
would be one collection, and each document would be a menu, and the sub
menus would be sub items, each menu item would have a children attribute

On Wed, Dec 18, 2013 at 9:30 AM, Rafael Diaz-Tushman <
[email protected]> wrote:

I can't think of a good reason to have two collections. navigation.menus
is currently just the top-level items in navigation.items


Reply to this email directly or view it on GitHubhttps://github.com//issues/10
.

@rdiaztushman
Copy link
Member Author

I had considered that, but came to the conclusion that embedding the entire tree in one document limits the searchability of the menu tree and restricts any future features associated with menu items (since each menu item wouldn't have a unique identifier). Reordering submenu items also becomes a complicated exercise.

Take a look at these tree structures: http://docs.mongodb.org/manual/tutorial/model-tree-structures/

I chose to use the Nested Set while also adding the Materialized Path (the MP makes it remarkably easy to enforce uniqueness). Site menu trees don't change that often (except during build out) and they're easy to work with (though you touch lots of documents each time you move/insert a document) so the Nested Set seemed ideal.

For the generic Categories model, I used Materialized Path alone.

@rdiaztushman
Copy link
Member Author

Edit: for the generic Categories model, I used Materialized Path and the Array of Ancestors (makes breadcrumbs really easy, e.g.).

@ChrisFrench
Copy link
Member

Cool sounds interesting.

This is cool to learn all this new stuff, because instead of learning some
obscure framework.

Learning in-depth Mongo, and advanced php features is much more interesting
and useful.

Chris

On Wed, Dec 18, 2013 at 2:09 PM, Rafael Diaz-Tushman <
[email protected]> wrote:

Edit: for the generic Categories model, I used Materialized Path and the
Array of Ancestors (makes breadcrumbs really easy, e.g.).


Reply to this email directly or view it on GitHubhttps://github.com//issues/10#issuecomment-30880919
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants