Yii2 Mongodb Migration -


in yii2 project have mongodb collections , migrations. want have sample code create multiple index on collection , want know there approach define columns data type in mongo @ all?

mongodb nosql, every document can structured differently. without knowing documents structure, it's impossible create sample code. index creation simple , there no real limit how many indexes collection can have. every document don't need have indexed key - value pairs.

at mongodb there no fixed type key (column). can insert: x:1 x:longint(1) x:"1" , have 3 documents, witch every 1 have different type of key x.

to answer second question...

/**      * builds , executes sql statement creating new index.      * @param string $name name of index. name quoted method.      * @param string $table table new index created for. table name quoted method.      * @param string $column column(s) should included in index. if there multiple columns, please separate them      * commas. column names quoted method.      * @param boolean $unique whether add unique constraint on created index.      */     public function createindex($name, $table, $column, $unique = false) 

Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -