@@ -103,20 +103,7 @@ module.exports = class Mongo extends Interface {
103
103
104
104
const self = this ;
105
105
106
- const collection = await this . database . createCollection ( name , mongo_options . open , ( ) => {
107
- /* Go through all the fields in the model */
108
- for ( const key in fields ) {
109
- const rule = fields [ key ] ;
110
-
111
- /* Create indices for any fields marked unique or identifiable */
112
- /* TODO: move this to Sapling proper, so we don't rely on drivers to implement model rule logic */
113
- if ( rule . unique || rule . identifiable ) {
114
- const ufields = { } ;
115
- ufields [ key ] = 1 ;
116
- self . createIndex ( name , ufields , { unique : true } ) ;
117
- }
118
- }
119
- } ) ;
106
+ const collection = await this . database . createCollection ( name , mongo_options . open ) ;
120
107
121
108
await this . close ( ) ;
122
109
@@ -163,23 +150,6 @@ module.exports = class Mongo extends Interface {
163
150
/* If there is an _id field in constraints, create a proper object ID object */
164
151
conditions = this . convertObjectId ( conditions ) ;
165
152
166
- /* TODO: find out what this is */
167
- if ( options [ 'in' ] ) {
168
- const inOpts = options [ 'in' ] ;
169
- const key = Object . keys ( inOpts ) [ 0 ] ;
170
-
171
- if ( key == '_id' ) { // TODO: include keys with rule.type == id
172
- for ( let i = 0 ; i < inOpts [ key ] . length ; ++ i ) {
173
- try {
174
- inOpts [ key ] [ i ] = mongo . ObjectID ( inOpts [ key ] [ i ] )
175
- } catch ( e ) { }
176
- }
177
- }
178
-
179
- conditions [ key ] = { '$in' : inOpts [ key ] } ;
180
- options = { } ;
181
- }
182
-
183
153
/* Get the collection */
184
154
const collection = await this . database . collection ( name , mongo_options . collection ) ;
185
155
0 commit comments