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

Vasiliy-Bondarenko picture Vasiliy-Bondarenko  路  3Comments

bastiendonjon picture bastiendonjon  路  3Comments

kschethan picture kschethan  路  3Comments

lgt picture lgt  路  3Comments

phuocduy1988 picture phuocduy1988  路  3Comments