File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed
Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -148,17 +148,17 @@ MongoStore._unknownError = function(err) {
148148} ;
149149
150150MongoStore . prototype . _createIndexesForRelationships = function ( collection , relationshipAttributeNames ) {
151- if ( ! ( relationshipAttributeNames instanceof Array ) || ! relationshipAttributeNames . length ) { return }
151+ if ( ! Array . isArray ( relationshipAttributeNames ) || ! relationshipAttributeNames . length ) return ;
152152
153153 var index = relationshipAttributeNames . reduce ( function ( partialIndex , name ) {
154154 if ( name ) {
155- partialIndex . push ( [ name + ".id" , 1 ] ) ;
155+ partialIndex [ name + ".id" ] = 1 ;
156156 }
157-
158157 return partialIndex ;
159- } , [ ] ) ;
160-
161- collection . ensureIndex ( index ) ;
158+ } , { } ) ;
159+ if ( Object . keys ( index ) . length ) {
160+ collection . createIndex ( index ) ;
161+ }
162162} ;
163163
164164MongoStore . prototype . _applySort = function ( request , cursor ) {
You can’t perform that action at this time.
0 commit comments