Laravel-mongodb: How to create Text Index?

Created on 13 Apr 2018  路  4Comments  路  Source: jenssegers/laravel-mongodb

How can i create text index in migrations?

question

Most helpful comment

Schema::table('provinces', function (Blueprint $table) {
        $table->index(['name' => 'text'], 'name_full_text');
});

All 4 comments

Hey, guys!
It's realy good qquestion.
How can I run totally raw query?
Need something like
DB::statement('db.proposals.createIndex( { summary: "text", content: "text", title: "text" } )');
@jenssegers

@Sebbba Thanks for your answer. I used this solution to my problem

https://docs.mongodb.com/php-library/current/tutorial/indexes/#create-indexes

Schema::table('provinces', function (Blueprint $table) {
        $table->index(['name' => 'text'], 'name_full_text');
});
Was this page helpful?
0 / 5 - 0 ratings

Related issues

gp187 picture gp187  路  19Comments

divine picture divine  路  61Comments

trololosha4real picture trololosha4real  路  20Comments

lzao picture lzao  路  29Comments

supaheckafresh picture supaheckafresh  路  40Comments