0

I need to create a Laravel migration for a unique key on multiple fields. The Mongodb command i want to map is something like this:

db.collection.ensureIndex( { a: 1, b: 1 }, { unique: true })

Is it possible with jenssegers/mongodb or with another package?

Gaurav Dave
  • 6,838
  • 9
  • 25
  • 39

1 Answers1

4
Schema::create('collection', function ( $collection ) {
      $collection->unique(array( 'a', 'b' ));
});
EvoTech
  • 41
  • 1