@@ -58,26 +58,15 @@ DatabaseController.prototype.validateClassName = function(className) {
58
58
// Returns a promise for a schema object.
59
59
// If we are provided a acceptor, then we run it on the schema.
60
60
// If the schema isn't accepted, we reload it at most once.
61
- DatabaseController . prototype . loadSchema = function ( acceptor = ( ) => true ) {
61
+ DatabaseController . prototype . loadSchema = function ( ) {
62
62
63
63
if ( ! this . schemaPromise ) {
64
64
this . schemaPromise = this . schemaCollection ( ) . then ( collection => {
65
65
delete this . schemaPromise ;
66
66
return SchemaController . load ( collection , this . adapter ) ;
67
67
} ) ;
68
- return this . schemaPromise ;
69
68
}
70
-
71
- return this . schemaPromise . then ( ( schema ) => {
72
- if ( acceptor ( schema ) ) {
73
- return schema ;
74
- }
75
- this . schemaPromise = this . schemaCollection ( ) . then ( collection => {
76
- delete this . schemaPromise ;
77
- return SchemaController . load ( collection , this . adapter ) ;
78
- } ) ;
79
- return this . schemaPromise ;
80
- } ) ;
69
+ return this . schemaPromise ;
81
70
} ;
82
71
83
72
// Returns a promise for the classname that is related to the given
@@ -147,13 +136,10 @@ DatabaseController.prototype.update = function(className, query, update, options
147
136
// Make a copy of the object, so we don't mutate the incoming data.
148
137
update = deepcopy ( update ) ;
149
138
150
- var acceptor = function ( schema ) {
151
- return schema . hasKeys ( className , Object . keys ( query ) ) ;
152
- } ;
153
139
var isMaster = ! ( 'acl' in options ) ;
154
140
var aclGroup = options . acl || [ ] ;
155
141
var mongoUpdate , schema ;
156
- return this . loadSchema ( acceptor )
142
+ return this . loadSchema ( )
157
143
. then ( s => {
158
144
schema = s ;
159
145
if ( ! isMaster ) {
@@ -586,9 +572,8 @@ DatabaseController.prototype.find = function(className, query, options = {}) {
586
572
}
587
573
let isMaster = ! ( 'acl' in options ) ;
588
574
let aclGroup = options . acl || [ ] ;
589
- let acceptor = schema => schema . hasKeys ( className , keysForQuery ( query ) )
590
575
let schema = null ;
591
- return this . loadSchema ( acceptor ) . then ( s => {
576
+ return this . loadSchema ( ) . then ( s => {
592
577
schema = s ;
593
578
if ( options . sort ) {
594
579
mongoOptions . sort = { } ;
0 commit comments