MongoDB does not work with custom fields with these revisioning modules:

http://drupal.org/project/revisioning
http://drupal.org/project/workbench_moderation

As far as I can tell, this is a bug in mongo_field_storage_field_storage_load(). It seems to be trying to match the revision id instead of node id. But I am not sure of the fix.

Comments

paul kim consulting’s picture

I've fixed this by changing

      $entity_id = $row['_id'];

In mongodb_field_storage_field_storage_load() to

    if ($row['nid']) {
      $entity_id = $row['nid'];
    }
    else {
      $entity_id = $row['_id'];
    }
misc’s picture

StatusFileSize
new753 bytes

Pacth for the above fix.

misc’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, revision_modules-1305580-2.patch, failed testing.

misc’s picture

Status: Needs work » Needs review
misc’s picture

Could somebody test if this patch works, so we could put in dev?

misc’s picture

Status: Needs review » Fixed

Committed to the latest dev.

Janne Salo’s picture

Status: Fixed » Needs work

I'm reopening this for two reasons:

1. The provided fix causes bug #1497456: Field Storage: undefined index: nid in hook field_storage_load
2. It totally breaks (for example) comments' fields. This is because comments have a field named 'nid'! Consider what happens when that is used as $entity_id in the loop. Right, bad things.

I'll try to come up with a patch that would provide best of both worlds. In the meantime, I strongly suggest NOT using this patch (nor the current dev version).

Janne Salo’s picture

StatusFileSize
new609 bytes

Here's my suggestion for a patch. This one doesn't break comments and doesn't throw notices. I do not know if it still serves its original purpose but I can't see any reason why it wouldn't. I'm a bit unsure whether any field other than _id in any type of result should ever be considered the entity id. For revisions, _id probably equals vid, the same way _id equals nid for current nodes? Isn't this desired? (I might be completely wrong here, since I'm not familiar with revisioning or workbench_moderation modules).

Janne Salo’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, revision_modules-1305580-9.patch, failed testing.

Janne Salo’s picture

Status: Needs work » Needs review
Janne Salo’s picture

Version: 7.x-1.0-beta2 » 7.x-1.x-dev
StatusFileSize
new786 bytes

Sorry, the previous patch was for 7.x-1.x-dev. This one's for the version actually mentioned in the issue.

Janne Salo’s picture

Version: 7.x-1.x-dev » 7.x-1.0-beta2

Now I accidentally changed the version... Seems I'm causing more harm than good.

misc’s picture

Status: Needs review » Reviewed & tested by the community
misc’s picture

Status: Reviewed & tested by the community » Fixed

Thanks, committed to the latest dev.

Status: Fixed » Closed (fixed)

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