Using CCK Node Reference with MongoDB Storage module gives the following error on the field management page:

EntityFieldQueryException: No entity_type in mongodb_field_storage_query()  (line 259 of mongodb_field_storage.module).

using node reference without mongodb storage does not display such error.

Comments

jthomasbailey’s picture

I'm getting this without Node Reference, only now it's line 300.

EntityFieldQueryException: No entity_type in mongodb_field_storage_query() (line 300 of /var/www/sites/all/modules/mongodb/mongodb_field_storage/mongodb_field_storage.module).
chx’s picture

Status: Active » Postponed (maintainer needs more info)

http://drupalcode.org/project/references.git/blob/refs/heads/7.x-2.x:/no... does not have EntityFieldQuery in it. Tell me more.

visabhishek’s picture

StatusFileSize
new15.73 KB

I'm getting this with integer cck,
ntityFieldQueryException: No entity_type in mongodb_field_storage_query() (line 298 of C:\wamp\www\drupal7\sites\all\modules\mongodb\mongodb_field_storage\mongodb_field_storage.module).

checkerap’s picture

Same here, but with a term reference field, I selected the vocabulary, but the select list is empty. Using latest dev version.

EntityFieldQueryException: No entity_type in mongodb_field_storage_query() (line 298 of /var/www/cookoo.ro/public_html/sites/all/modules/mongodb/mongodb_field_storage/mongodb_field_storage.module).

larowlan’s picture

Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new2.48 KB

The issue is that mongodb_field_storage_query is also called without an entity type in operations such as list module's _list_values_in_use function - so we need to inspect the query conditions more closely when we construct and execute our $field_has_data_query object

Patch attached, thanks chx for pointing me in the right direction in #drupal-contribute

Status: Needs review » Needs work

The last submitted patch, 839264-entity-field-query-no-entity-type-exception.patch, failed testing.

larowlan’s picture

Status: Needs work » Needs review
StatusFileSize
new2.83 KB

This one also returns FALSE immediately if the field is not yet attached to any bundles (previously this raised a php warning that $field['bundles'] was not an array).

Status: Needs review » Needs work

The last submitted patch, 839264-entity-field-query-no-entity-type-exception-7.patch, failed testing.

Donaldd’s picture

Without any patches I'm also getting the following error.
WD cron: EntityFieldQueryException: No entity_type in mongodb_field_storage_query() (line 298 of /sites/all/modules/mongodb/mongodb_field_storage/mongodb_field_storage.module).

However with the patches applied I'm still getting an error.

With the patch from #5
WD cron: EntityFieldQueryException: No entity_type in mongodb_field_storage_query() (line 320 of /sites/all/modules/mongodb/mongodb_field_storage/mongodb_field_storage.module).

and with the patch from #7
WD cron: EntityFieldQueryException: No entity_type in mongodb_field_storage_query() (line 324 of /sites/all/modules/mongodb/mongodb_field_storage/mongodb_field_storage.module).

Donaldd’s picture

What's the point of this bit of code, cause I can't figure out what is meant in the comments?

 foreach (get_object_vars($field_has_data_query) as $key => $value) {
        // we rebuild the has_data query and then compare with the received query structure
        // but by this point the query is altered so it's always failing.
        if ($key != 'altered' && $value != $query->$key) {
          $success = FALSE;
        }

So after commenting this out, I no longer get the error and everything seems to be working fine.

Thanks,
D

ydnar79’s picture

I have been testing the patches / suggestions from above, but none seem to work. By chance has anyone come up with a solution to fix this issue?

While I cannot speak for anyone else, this issue is a major no go for me being able to utilize MongoDB on several projects that I am working on. Obviously, MongoDB has some major advantages other database options, but this issue is pretty major.... at least for me. Although, I doubt that I am the only one.....

Any assistance / advice would be greatly appreciated.

drupik’s picture

Have the same:
EntityFieldQueryException: No entity_type w mongodb_field_storage_query() (line 301 z /home/online/drupal/sites/all/modules/mongodb/mongodb_field_storage/mongodb_field_storage.module).

after removed field 'body' - WSOD

Fatal error: Cannot unset string offsets in /home/online/drupal/sites/all/modules/mongodb/mongodb_field_storage/mongodb_field_storage.module on line 87

so commented out that line 87 unset($column_values['_language']);
to bring my site to life.

misc’s picture

@drupik, are you using CCK Node Reference ?

drupik’s picture

@MiSc no, for field I've installed only Entity Reference and Field Permissions, but not using it nowhere at the moment.

misc’s picture

Assigned: Unassigned » misc

Ok, I will look into this.

misc’s picture

Status: Needs work » Active

I could not reproduce. I Installed latest dev, activated Entity Reference, added reference field. Edited content, added a reference, saved. Worked. No errors. Same for Field Permissions.

Could you try to install the latest dev, and see what you get?

drupik’s picture

Yes, no errors, I've got errors only when remove field, any field not only reference filed.

Forgot to Thank You for the great module ;), my laptop working 5 time faster, thats what im looking for few years, thank You! :D

misc’s picture

@drupik, that is maybe another issue, anyhow, updated the patch posted earlier @larowlan, this works for me with the latest dev if you delete a field, but the field data is still left in mongodb, we should make a fix for that also.

The thanks should go to the guys who started this module, I just jumped on the train.

misc’s picture

StatusFileSize
new5.88 KB

Ups sorry, that was the old patch. Here is the new one.

misc’s picture

Status: Active » Needs review
drupik’s picture

Thanks, now everything looking good.

but the field data is still left in mongodb

thats no problem, I do not expect to have several hundred fields to delete them later :D

misc’s picture

@drupik: Yeah, but it would be nice if it would be deleted ;-)

Anyhow, tested to add a Reference field, User and Node, with the patch above to latest dev, and had no problem. @drupik, do you think it should be marked as Reviewed & tested by the community?

drupik’s picture

I do not know, I'm new in drupal, I tested and it works, works with entity reference.
Dont worry about node reference, it will be deprecated:

References will most probably be deprecated in the near future in favor of Entity Reference, which should probably be considered first on fresh D7 projects.

misc’s picture

Status: Fixed » Reviewed & tested by the community

If it works, we set is RTBC :-). Getting this into dev.

misc’s picture

Status: Needs review » Fixed

Commited to dev.

Status: Reviewed & tested by the community » Closed (fixed)

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

joelpittet’s picture

Nice work, latest dev fixed this!