@@ -11,7 +11,7 @@ const deepcopy = require('deepcopy');
11
11
12
12
// options can contain:
13
13
// collectionPrefix: the string to put in front of every collection name.
14
- function DatabaseController ( adapter , { collectionPrefix, unsafe } = { } ) {
14
+ function DatabaseController ( adapter , { collectionPrefix, skipValidation } = { } ) {
15
15
this . adapter = adapter ;
16
16
17
17
this . collectionPrefix = collectionPrefix ;
@@ -20,7 +20,7 @@ function DatabaseController(adapter, { collectionPrefix, unsafe } = {}) {
20
20
// one request that uses different schemas for different parts of
21
21
// it. Instead, use loadSchema to get a schema.
22
22
this . schemaPromise = null ;
23
- this . unsafe = ! ! unsafe ;
23
+ this . skipValidation = ! ! skipValidation ;
24
24
this . connect ( ) ;
25
25
26
26
Object . defineProperty ( this , 'transform' , {
@@ -30,8 +30,8 @@ function DatabaseController(adapter, { collectionPrefix, unsafe } = {}) {
30
30
} )
31
31
}
32
32
33
- DatabaseController . prototype . Unsafe = function ( ) {
34
- return new DatabaseController ( this . adapter , { collectionPrefix : this . collectionPrefix , unsafe : true } ) ;
33
+ DatabaseController . prototype . WithoutValidation = function ( ) {
34
+ return new DatabaseController ( this . adapter , { collectionPrefix : this . collectionPrefix , skipValidation : true } ) ;
35
35
}
36
36
37
37
// Connects to the database. Returns a promise that resolves when the
@@ -61,7 +61,7 @@ function returnsTrue() {
61
61
}
62
62
63
63
DatabaseController . prototype . validateClassName = function ( className ) {
64
- if ( this . unsafe ) {
64
+ if ( this . skipValidation ) {
65
65
return Promise . resolve ( ) ;
66
66
}
67
67
if ( ! Schema . classNameIsValid ( className ) ) {
@@ -179,11 +179,11 @@ DatabaseController.prototype.update = function(className, query, update, options
179
179
. then ( ( ) => this . handleRelationUpdates ( className , query . objectId , update ) )
180
180
. then ( ( ) => adaptiveCollection ( this , className ) )
181
181
. then ( collection => {
182
- var mongoWhere = this . transform . transformWhere ( schema , className , query , { validate : ! this . unsafe } ) ;
182
+ var mongoWhere = this . transform . transformWhere ( schema , className , query , { validate : ! this . skipValidation } ) ;
183
183
if ( options . acl ) {
184
184
mongoWhere = this . transform . addWriteACL ( mongoWhere , options . acl ) ;
185
185
}
186
- mongoUpdate = this . transform . transformUpdate ( schema , className , update , { validate : ! this . unsafe } ) ;
186
+ mongoUpdate = this . transform . transformUpdate ( schema , className , update , { validate : ! this . skipValidation } ) ;
187
187
if ( options . many ) {
188
188
return collection . updateMany ( mongoWhere , mongoUpdate ) ;
189
189
} else if ( options . upsert ) {
@@ -197,7 +197,7 @@ DatabaseController.prototype.update = function(className, query, update, options
197
197
return Promise . reject ( new Parse . Error ( Parse . Error . OBJECT_NOT_FOUND ,
198
198
'Object not found.' ) ) ;
199
199
}
200
- if ( this . unsafe ) {
200
+ if ( this . skipValidation ) {
201
201
return Promise . resolve ( result ) ;
202
202
}
203
203
return sanitizeDatabaseResult ( originalUpdate , result ) ;
@@ -319,7 +319,7 @@ DatabaseController.prototype.destroy = function(className, query, options = {})
319
319
} )
320
320
. then ( ( ) => adaptiveCollection ( this , className ) )
321
321
. then ( collection => {
322
- let mongoWhere = this . transform . transformWhere ( schema , className , query , { validate : ! this . unsafe } ) ;
322
+ let mongoWhere = this . transform . transformWhere ( schema , className , query , { validate : ! this . skipValidation } ) ;
323
323
if ( options . acl ) {
324
324
mongoWhere = this . transform . addWriteACL ( mongoWhere , options . acl ) ;
325
325
}
0 commit comments