@@ -9,14 +9,14 @@ var Parse = require('parse/node').Parse;
99var Schema = require ( './../Schema' ) ;
1010const deepcopy = require ( 'deepcopy' ) ;
1111
12- function DatabaseController ( adapter , { unsafe } = { } ) {
12+ function DatabaseController ( adapter , { skipValidation } = { } ) {
1313 this . adapter = adapter ;
1414
1515 // We don't want a mutable this.schema, because then you could have
1616 // one request that uses different schemas for different parts of
1717 // it. Instead, use loadSchema to get a schema.
1818 this . schemaPromise = null ;
19- this . unsafe = ! ! unsafe ;
19+ this . skipValidation = ! ! skipValidation ;
2020 this . connect ( ) ;
2121
2222 Object . defineProperty ( this , 'transform' , {
@@ -26,8 +26,8 @@ function DatabaseController(adapter, { unsafe } = {}) {
2626 } )
2727}
2828
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 } ) ;
3131}
3232
3333// Connects to the database. Returns a promise that resolves when the
@@ -49,7 +49,7 @@ DatabaseController.prototype.dropCollection = function(className) {
4949} ;
5050
5151DatabaseController . prototype . validateClassName = function ( className ) {
52- if ( this . unsafe ) {
52+ if ( this . skipValidation ) {
5353 return Promise . resolve ( ) ;
5454 }
5555 if ( ! Schema . classNameIsValid ( className ) ) {
@@ -167,11 +167,11 @@ DatabaseController.prototype.update = function(className, query, update, options
167167 . then ( ( ) => this . handleRelationUpdates ( className , query . objectId , update ) )
168168 . then ( ( ) => this . adapter . adaptiveCollection ( className ) )
169169 . 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 } ) ;
171171 if ( options . acl ) {
172172 mongoWhere = this . transform . addWriteACL ( mongoWhere , options . acl ) ;
173173 }
174- mongoUpdate = this . transform . transformUpdate ( schema , className , update , { validate : ! this . unsafe } ) ;
174+ mongoUpdate = this . transform . transformUpdate ( schema , className , update , { validate : ! this . skipValidation } ) ;
175175 if ( options . many ) {
176176 return collection . updateMany ( mongoWhere , mongoUpdate ) ;
177177 } else if ( options . upsert ) {
@@ -185,7 +185,7 @@ DatabaseController.prototype.update = function(className, query, update, options
185185 return Promise . reject ( new Parse . Error ( Parse . Error . OBJECT_NOT_FOUND ,
186186 'Object not found.' ) ) ;
187187 }
188- if ( this . unsafe ) {
188+ if ( this . skipValidation ) {
189189 return Promise . resolve ( result ) ;
190190 }
191191 return sanitizeDatabaseResult ( originalUpdate , result ) ;
@@ -307,7 +307,7 @@ DatabaseController.prototype.destroy = function(className, query, options = {})
307307 } )
308308 . then ( ( ) => this . adapter . adaptiveCollection ( className ) )
309309 . 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 } ) ;
311311 if ( options . acl ) {
312312 mongoWhere = this . transform . addWriteACL ( mongoWhere , options . acl ) ;
313313 }
0 commit comments