Mongo Entity is for developers. It provides no enhancements out of the box. Modules must create custom entity types with hook_entity_info that use the included entity and controller classes to store their data in a Mongo collection.

Mongo Entity stores the entire entity as a document in a Mongo collection, including the ID, name, any properties, and all field data. It also provides subclasses for embedded entities- entities that are always stored with their parent. An example of an embedded entity might be a line item in an order- for practical purposes, the line item would never be used outside of the order. Rather than storing the line item data in its own table (or storing the fields for that line item entity type in its own collection, as the MongoDB Field Storage module does), the embedded entity is stored with its parent, in the "order" collection. Loading the order would load all of the line items, and loading a single line item would also load the order, with no extra collection queries, and minimal overhead.

The intention with Mongo Entity is to read and write complex data structures in a way that matches the model for that entity, but provides all the convenience of the Entity API.

Sandbox Project:

Git Repository:

git clone --branch 7.x-1.x mongo_entity


PA robot’s picture

Status: Needs review » Needs work

There are some errors reported by automated review tools, did you already check them? See

We are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and we will take a look at your project right away :-)

Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (they found some problems with the project) or "reviewed & tested by the community" (they found no major flaws).

I'm a robot and this is an automated message from Project Applications Scraper.

bartram’s picture

Status: Needs work » Needs review

I've reviewed and fixed nearly all of the issues flagged by PA robot. Many of the remaining errors are {@inheritdoc} statements that are reported incorrectly by the review tool.

There are four class functions that the review tool flagged for using underscores rather than lowerCamel. These are:


I patterned these function names on EntityDefaultUIController::hook_menu. These are convenience functions that implement class based pseudo-hooks. I'm open to changing the names, but it is not clear what is the correct naming convention for this case.

deekayen’s picture

Status: Needs review » Needs work

It looks like the plugin depends on entityreference but only entity is marked as a dependency?

zterry95’s picture

remove below line from info file:

files[] = mongo_entity.module

This is extra definitely.

bartram’s picture

Status: Needs work » Needs review

Thanks for the reviews. I added the EntityReference dependency, and removed the redundant files[] declaration.

bartram’s picture

Actually, I think the EntityReference module is optional. The plugin just provides a new SelectionHandler if you have it (and Ctools) enabled. It shouldn't cause an error if the EntityReference module can't be found.

davidam’s picture

I continue seeing errors in ventral ( On other hand, I think that README must have the extension .txt.

kscheirer’s picture

Status: Needs review » Reviewed & tested by the community

Mongo Entity is dependent on Mongodb. However, it may conflict with the included MongoDB Field Storage module.

Wait, your module both depends on, and conflicts with, MongoDB? That doesn't sound right... can you provide more information?

Rename to README.txt.

// Get Views to shut up about "undefined index".


The class definitions for MongoEntity and MongoEntityController should go in a separate file if possible.

No major issues found though.

Top Shelf Modules - Enterprise modules from the community for the community.

bartram’s picture

The Mongodb project has 8 submodules, plus the core- one for storing blocks with Mongo, one for storing watchdog logs with Mongo, one for storing field data in Mongo, etc. Mongo Entity requires the core MongoDB module, but it may conflict with this last submodule, MongoDB Storage. However, I have recently enabled both modules on a site without issue. It requires more testing.

I've also added support for bundles.

Nearly all the remaining messages have to do with {@inheritdoc} statements that are reported incorrectly by the review tool.

bartram’s picture

Status: Reviewed & tested by the community » Fixed
deekayen’s picture

You probably should have waited for someone to mark you as a vetted user before marking this fixed. I marked you vetted just now anyway since I'll do so in combination with vouching for the projects you did with me.

klausi’s picture

Thanks for helping out here deekayen! I added you to the list of code review administrators:

And for reference here is the usual approval message we use:

Thanks for your contribution, bartram!

I updated your account to let you promote this to a full project and also create new projects as either a sandbox or a "full" project.

Here are some recommended readings to help with excellent maintainership:

You can find lots more contributors chatting on IRC in #drupal-contribute. So, come hang out and get involved!

Thanks, also, for your patience with the review process. Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.

Thanks to the dedicated reviewer(s) as well.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.