@@ -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 ) ) {
@@ -180,11 +180,11 @@ DatabaseController.prototype.update = function(className, query, update, options
180
180
. then ( ( ) => this . handleRelationUpdates ( className , query . objectId , update ) )
181
181
. then ( ( ) => adaptiveCollection ( this , className ) )
182
182
. then ( collection => {
183
- var mongoWhere = this . transform . transformWhere ( schema , className , query , { validate : ! this . unsafe } ) ;
183
+ var mongoWhere = this . transform . transformWhere ( schema , className , query , { validate : ! this . skipValidation } ) ;
184
184
if ( options . acl ) {
185
185
mongoWhere = this . transform . addWriteACL ( mongoWhere , options . acl ) ;
186
186
}
187
- mongoUpdate = this . transform . transformUpdate ( schema , className , update , { validate : ! this . unsafe } ) ;
187
+ mongoUpdate = this . transform . transformUpdate ( schema , className , update , { validate : ! this . skipValidation } ) ;
188
188
if ( options . many ) {
189
189
return collection . updateMany ( mongoWhere , mongoUpdate ) ;
190
190
} else if ( options . upsert ) {
@@ -198,7 +198,7 @@ DatabaseController.prototype.update = function(className, query, update, options
198
198
return Promise . reject ( new Parse . Error ( Parse . Error . OBJECT_NOT_FOUND ,
199
199
'Object not found.' ) ) ;
200
200
}
201
- if ( this . unsafe ) {
201
+ if ( this . skipValidation ) {
202
202
return Promise . resolve ( result ) ;
203
203
}
204
204
return sanitizeDatabaseResult ( originalUpdate , result ) ;
@@ -320,7 +320,7 @@ DatabaseController.prototype.destroy = function(className, query, options = {})
320
320
} )
321
321
. then ( ( ) => adaptiveCollection ( this , className ) )
322
322
. then ( collection => {
323
- let mongoWhere = this . transform . transformWhere ( schema , className , query , { validate : ! this . unsafe } ) ;
323
+ let mongoWhere = this . transform . transformWhere ( schema , className , query , { validate : ! this . skipValidation } ) ;
324
324
if ( options . acl ) {
325
325
mongoWhere = this . transform . addWriteACL ( mongoWhere , options . acl ) ;
326
326
}
0 commit comments