Note that there are some explanatory texts on larger screens.

plurals
  1. POMongoDB running command in lithium
    primarykey
    data
    text
    <p>I'm trying to run a full text search against some data that is stored in mongoDb using Lithium. </p> <p>Here is how I am trying to do it in my controller:</p> <pre><code>$mongodb = Connections::get('default')-&gt;connection; $results = Page::connection()-&gt;connection-&gt;command(array("text" =&gt; "Page", 'search' =&gt; "term" )); </code></pre> <p>I've also tried:</p> <pre><code>$results = Page::connection()-&gt;connection-&gt;command(array("text" =&gt; "Page", 'search' =&gt; "term" )); </code></pre> <p>However, both of these return: Fatal error: Call to a member function command() on a non-object</p> <p>What am I doing wrong?</p> <p>EDIT:</p> <p>I should add that a simple query on Page is working just fine. For instance:</p> <pre><code>$results = Page::find('all'); </code></pre> <p>Does return an array with all of the documents in the pages collection like I would expect it to. </p> <p>UPDATE 2:</p> <p>I was running all of this from WAMP server. I tried today running it from a linux server, but still got the same exact error. I am really stumped by this and could use some help. Anyone have any ideas?</p> <p>here is the Page model as it sits now:</p> <pre><code>&lt;?php namespace app\models; use lithium\data\Connections; //added during debugging use lithium\data\source\MongoDb; //added during debuging class Page extends \lithium\data\Model { } ?&gt; </code></pre> <p>Here is my connection:</p> <pre><code> Connections::add('default', array( 'type' =&gt; 'MongoDb', 'host' =&gt; '192.168.48.128', 'database' =&gt; 'my_collection' )); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload