@@ -12,11 +12,11 @@ var _ = require('lodash');
1212// If prefix is specified, it will be prepended to this name, like acl_resources
1313var aclCollectionName = 'resources' ;
1414
15- function MongoDBBackend ( db , prefix , useSingle , useRawColletionNames ) {
15+ function MongoDBBackend ( db , prefix , useSingle , useRawCollectionNames ) {
1616 this . db = db ;
1717 this . prefix = typeof prefix !== 'undefined' ? prefix : '' ;
1818 this . useSingle = ( typeof useSingle !== 'undefined' ) ? useSingle : false ;
19- this . useRawColletionNames = useRawColletionNames === false ; // requires explicit boolean false value
19+ this . useRawCollectionNames = useRawCollectionNames === false ; // requires explicit boolean false value
2020}
2121
2222MongoDBBackend . prototype = {
@@ -62,7 +62,7 @@ MongoDBBackend.prototype = {
6262 var searchParams = ( this . useSingle ? { _bucketname : bucket , key :key } : { key :key } ) ;
6363 var collName = ( this . useSingle ? aclCollectionName : bucket ) ;
6464
65- this . db . collection ( this . prefix + removeUnsupportedChar ( collName , this . useRawColletionNames ) , function ( err , collection ) {
65+ this . db . collection ( this . prefix + removeUnsupportedChar ( collName , this . useRawCollectionNames ) , function ( err , collection ) {
6666 if ( err instanceof Error ) return cb ( err ) ;
6767 // Excluding bucket field from search result
6868 collection . findOne ( searchParams , { _bucketname : 0 } , function ( err , doc ) {
@@ -85,7 +85,7 @@ MongoDBBackend.prototype = {
8585 var searchParams = ( this . useSingle ? { _bucketname : bucket , key : { $in : keys } } : { key : { $in : keys } } ) ;
8686 var collName = ( this . useSingle ? aclCollectionName : bucket ) ;
8787
88- this . db . collection ( this . prefix + removeUnsupportedChar ( collName , this . useRawColletionNames ) , function ( err , collection ) {
88+ this . db . collection ( this . prefix + removeUnsupportedChar ( collName , this . useRawCollectionNames ) , function ( err , collection ) {
8989 if ( err instanceof Error ) return cb ( err ) ;
9090 // Excluding bucket field from search result
9191 collection . find ( searchParams , { _bucketname : 0 } ) . toArray ( function ( err , docs ) {
@@ -117,7 +117,7 @@ MongoDBBackend.prototype = {
117117 var collName = ( self . useSingle ? aclCollectionName : bucket ) ;
118118 transaction . push ( function ( cb ) {
119119 values = makeArray ( values ) ;
120- self . db . collection ( self . prefix + removeUnsupportedChar ( collName , self . useRawColletionNames ) , function ( err , collection ) {
120+ self . db . collection ( self . prefix + removeUnsupportedChar ( collName , self . useRawCollectionNames ) , function ( err , collection ) {
121121 if ( err instanceof Error ) return cb ( err ) ;
122122
123123 // build doc from array values
@@ -133,7 +133,7 @@ MongoDBBackend.prototype = {
133133 } ) ;
134134
135135 transaction . push ( function ( cb ) {
136- self . db . collection ( self . prefix + removeUnsupportedChar ( collName , self . useRawColletionNames ) , function ( err , collection ) {
136+ self . db . collection ( self . prefix + removeUnsupportedChar ( collName , self . useRawCollectionNames ) , function ( err , collection ) {
137137 // Create index
138138 collection . ensureIndex ( { _bucketname : 1 , key : 1 } , function ( err ) {
139139 if ( err instanceof Error ) {
@@ -159,7 +159,7 @@ MongoDBBackend.prototype = {
159159 var collName = ( self . useSingle ? aclCollectionName : bucket ) ;
160160
161161 transaction . push ( function ( cb ) {
162- self . db . collection ( self . prefix + removeUnsupportedChar ( collName , self . useRawColletionNames ) , function ( err , collection ) {
162+ self . db . collection ( self . prefix + removeUnsupportedChar ( collName , self . useRawCollectionNames ) , function ( err , collection ) {
163163 if ( err instanceof Error ) return cb ( err ) ;
164164 collection . remove ( updateParams , { safe :true } , function ( err ) {
165165 if ( err instanceof Error ) return cb ( err ) ;
@@ -183,7 +183,7 @@ MongoDBBackend.prototype = {
183183
184184 values = makeArray ( values ) ;
185185 transaction . push ( function ( cb ) {
186- self . db . collection ( self . prefix + removeUnsupportedChar ( collName , self . useRawColletionNames ) , function ( err , collection ) {
186+ self . db . collection ( self . prefix + removeUnsupportedChar ( collName , self . useRawCollectionNames ) , function ( err , collection ) {
187187 if ( err instanceof Error ) return cb ( err ) ;
188188
189189 // build doc from array values
@@ -200,8 +200,8 @@ MongoDBBackend.prototype = {
200200 }
201201}
202202
203- function removeUnsupportedChar ( text , useRawColletionNames ) {
204- if ( ! useRawColletionNames && ( typeof text === 'string' || text instanceof String ) ) {
203+ function removeUnsupportedChar ( text , useRawCollectionNames ) {
204+ if ( ! useRawCollectionNames && ( typeof text === 'string' || text instanceof String ) ) {
205205 text = decodeURIComponent ( text ) ;
206206 text = text . replace ( / [ / \s ] / g, '_' ) ; // replaces slashes and spaces
207207 }
0 commit comments