Perhaps a snippet should be included in the documentation, but when moving from an SQL oriented DB to MongoDB what is the proper drupal way to migrate queries in custom modules with this modules default setup. Pardon my novice understanding of MongoDB.
For example take a basic query that returns a list of all fields within a specified entity bundle:
<?php
$result = db_query('SELECT field_name FROM {field_config_instance} WHERE bundle = :bundle', array(':bundle' => $field_collection));
?>What is the appropriate MongoDB translation when using this module? Perhaps something like:
<?php db.field_config_instance.find( <bundle = $field_collection>, <field_name> )
?>
Comments
Comment #0.0
jmomandown commentedcode
Comment #1
fgmI would say you probably should not be using mongodb queries as such, but building EntityFieldQuery instances, which will take care of the actual storage implementation for you, even should it change someday.
For details, you may want to look into the
mongodb_field_storage_query()function, which shows how to build a mongo query from an EFQ, so that you can use this as a base for your specific querying needs.Comment #2
fgmNo answer in one month: assuming fixed previously or by previous answer. Feel free to reopen if needed.