Download & Extend

MongoDB Field Storage does not work with various revisioning modules

Project:Mongodb
Version:7.x-1.0-beta2
Component:Field storage
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

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

#1

I've fixed this by changing

<?php
      $entity_id
= $row['_id'];
?>

In mongodb_field_storage_field_storage_load() to

<?php
   
if ($row['nid']) {
     
$entity_id = $row['nid'];
    }
    else {
     
$entity_id = $row['_id'];
    }
?>

#2

Pacth for the above fix.

AttachmentSizeStatusTest resultOperations
revision_modules-1305580-2.patch753 bytesIdleFAILED: [[SimpleTest]]: [MySQL] 11 pass(es), 6 fail(s), and 0 exception(s).View details

#3

Status:active» needs review

#4

Status:needs review» needs work

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

#5

Status:needs work» needs review

#6

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

#7

Status:needs review» fixed

Committed to the latest dev.

#8

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).

#9

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).

AttachmentSizeStatusTest resultOperations
revision_modules-1305580-9.patch609 bytesIdleFAILED: [[SimpleTest]]: [MySQL] Unable to apply patch revision_modules-1305580-9.patch. Unable to apply patch. See the log in the details link for more information.View details

#10

Status:needs work» needs review

#11

Status:needs review» needs work

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

#12

Status:needs work» needs review

#13

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

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

AttachmentSizeStatusTest resultOperations
revision_modules-1305580-13.patch786 bytesTest request sentNoneView details

#14

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.

#15

Status:needs review» reviewed & tested by the community

#16

Status:reviewed & tested by the community» fixed

Thanks, committed to the latest dev.

#17

Status:fixed» closed (fixed)

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