File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ function ChainFind(Model, opts) {
4545 } else {
4646 omit = Array . prototype . slice . apply ( arguments ) ;
4747 }
48- this . only ( _ . difference ( Object . keys ( Model . properties ) , omit ) ) ;
48+ this . only ( _ . difference ( Object . keys ( Model . allProperties ) , omit ) ) ;
4949 return this ;
5050 } ,
5151 limit : function ( limit ) {
Original file line number Diff line number Diff line change @@ -16,22 +16,26 @@ describe("Model.find() chaining", function() {
1616 age : Number
1717 } ) ;
1818 Person . hasMany ( "parents" ) ;
19+ Person . hasOne ( "friend" ) ;
1920
2021 ORM . singleton . clear ( ) ; // clear cache
2122
2223 return helper . dropSync ( Person , function ( ) {
2324 Person . create ( [ {
24- name : "John" ,
25- surname : "Doe" ,
26- age : 18
25+ name : "John" ,
26+ surname : "Doe" ,
27+ age : 18 ,
28+ friend_id : 1
2729 } , {
28- name : "Jane" ,
29- surname : "Doe" ,
30- age : 20
30+ name : "Jane" ,
31+ surname : "Doe" ,
32+ age : 20 ,
33+ friend_id : 1
3134 } , {
32- name : "Jane" ,
33- surname : "Dean" ,
34- age : 18
35+ name : "Jane" ,
36+ surname : "Dean" ,
37+ age : 18 ,
38+ friend_id : 1
3539 } ] , done ) ;
3640 } ) ;
3741 } ;
@@ -215,6 +219,8 @@ describe("Model.find() chaining", function() {
215219 Person . find ( ) . omit ( "age" , "surname" ) . order ( "-age" ) . run ( function ( err , instances ) {
216220 should . equal ( err , null ) ;
217221 instances . should . have . property ( "length" , 3 ) ;
222+ should . exist ( instances [ 0 ] . id ) ;
223+ should . exist ( instances [ 0 ] . friend_id ) ;
218224 instances [ 0 ] . should . have . property ( "age" , null ) ;
219225 instances [ 0 ] . should . have . property ( "surname" , null ) ;
220226 instances [ 0 ] . should . have . property ( "name" , "Jane" ) ;
You can’t perform that action at this time.
0 commit comments