()
| 1152 | return await this.createSearchIndexes(); |
| 1153 | }; |
| 1154 | const _createCollection = async() => { |
| 1155 | let autoCreate = utils.getOption( |
| 1156 | 'autoCreate', |
| 1157 | this.schema.options, |
| 1158 | conn.config |
| 1159 | // No base.options here because we don't want to take the base value if the connection hasn't |
| 1160 | // set it yet |
| 1161 | ); |
| 1162 | if (autoCreate == null) { |
| 1163 | // `autoCreate` may later be set when the connection is opened, so wait for connect before checking |
| 1164 | await conn._waitForConnect(true); |
| 1165 | autoCreate = utils.getOption( |
| 1166 | 'autoCreate', |
| 1167 | this.schema.options, |
| 1168 | conn.config, |
| 1169 | conn.base.options |
| 1170 | ); |
| 1171 | } |
| 1172 | |
| 1173 | if (!autoCreate) { |
| 1174 | return; |
| 1175 | } |
| 1176 | |
| 1177 | return await this.createCollection(); |
| 1178 | }; |
| 1179 | |
| 1180 | this.$init = _createCollection(). |
| 1181 | then(() => _ensureIndexes()). |
no test coverage detected
searching dependent graphs…