@@ -9,14 +9,14 @@ var Parse = require('parse/node').Parse;
9
9
var Schema = require ( './../Schema' ) ;
10
10
const deepcopy = require ( 'deepcopy' ) ;
11
11
12
- function DatabaseController ( adapter , { unsafe } = { } ) {
12
+ function DatabaseController ( adapter , { skipValidation } = { } ) {
13
13
this . adapter = adapter ;
14
14
15
15
// We don't want a mutable this.schema, because then you could have
16
16
// one request that uses different schemas for different parts of
17
17
// it. Instead, use loadSchema to get a schema.
18
18
this . schemaPromise = null ;
19
- this . unsafe = ! ! unsafe ;
19
+ this . skipValidation = ! ! skipValidation ;
20
20
this . connect ( ) ;
21
21
22
22
Object . defineProperty ( this , 'transform' , {
@@ -26,8 +26,8 @@ function DatabaseController(adapter, { unsafe } = {}) {
26
26
} )
27
27
}
28
28
29
- DatabaseController . prototype . Unsafe = function ( ) {
30
- return new DatabaseController ( this . adapter , { collectionPrefix : this . collectionPrefix , unsafe : true } ) ;
29
+ DatabaseController . prototype . WithoutValidation = function ( ) {
30
+ return new DatabaseController ( this . adapter , { collectionPrefix : this . collectionPrefix , skipValidation : true } ) ;
31
31
}
32
32
33
33
// Connects to the database. Returns a promise that resolves when the
@@ -49,7 +49,7 @@ DatabaseController.prototype.dropCollection = function(className) {
49
49
} ;
50
50
51
51
DatabaseController . prototype . validateClassName = function ( className ) {
52
- if ( this . unsafe ) {
52
+ if ( this . skipValidation ) {
53
53
return Promise . resolve ( ) ;
54
54
}
55
55
if ( ! Schema . classNameIsValid ( className ) ) {
@@ -167,11 +167,11 @@ DatabaseController.prototype.update = function(className, query, update, options
167
167
. then ( ( ) => this . handleRelationUpdates ( className , query . objectId , update ) )
168
168
. then ( ( ) => this . adapter . adaptiveCollection ( className ) )
169
169
. then ( collection => {
170
- var mongoWhere = this . transform . transformWhere ( schema , className , query , { validate : ! this . unsafe } ) ;
170
+ var mongoWhere = this . transform . transformWhere ( schema , className , query , { validate : ! this . skipValidation } ) ;
171
171
if ( options . acl ) {
172
172
mongoWhere = this . transform . addWriteACL ( mongoWhere , options . acl ) ;
173
173
}
174
- mongoUpdate = this . transform . transformUpdate ( schema , className , update , { validate : ! this . unsafe } ) ;
174
+ mongoUpdate = this . transform . transformUpdate ( schema , className , update , { validate : ! this . skipValidation } ) ;
175
175
if ( options . many ) {
176
176
return collection . updateMany ( mongoWhere , mongoUpdate ) ;
177
177
} else if ( options . upsert ) {
@@ -185,7 +185,7 @@ DatabaseController.prototype.update = function(className, query, update, options
185
185
return Promise . reject ( new Parse . Error ( Parse . Error . OBJECT_NOT_FOUND ,
186
186
'Object not found.' ) ) ;
187
187
}
188
- if ( this . unsafe ) {
188
+ if ( this . skipValidation ) {
189
189
return Promise . resolve ( result ) ;
190
190
}
191
191
return sanitizeDatabaseResult ( originalUpdate , result ) ;
@@ -307,7 +307,7 @@ DatabaseController.prototype.destroy = function(className, query, options = {})
307
307
} )
308
308
. then ( ( ) => this . adapter . adaptiveCollection ( className ) )
309
309
. then ( collection => {
310
- let mongoWhere = this . transform . transformWhere ( schema , className , query , { validate : ! this . unsafe } ) ;
310
+ let mongoWhere = this . transform . transformWhere ( schema , className , query , { validate : ! this . skipValidation } ) ;
311
311
if ( options . acl ) {
312
312
mongoWhere = this . transform . addWriteACL ( mongoWhere , options . acl ) ;
313
313
}
0 commit comments