@@ -28,7 +28,7 @@ module.exports = {
2828 * @param {[type] } criteria
2929 * @param {Function } cb
3030 */
31- join : function ( criteria , cb ) {
31+ join : function ( criteria , cb , metaContainer ) {
3232
3333 // Normalize Arguments
3434 criteria = normalize . criteria ( criteria ) ;
@@ -49,7 +49,7 @@ module.exports = {
4949 // This is done here so that everywhere else in the codebase can use the collection identity.
5050 criteria = schema . serializeJoins ( criteria , this . query . waterline . schema ) ;
5151
52- adapter . join ( connName , this . collection , criteria , cb ) ;
52+ adapter . join ( connName , this . collection , criteria , cb , metaContainer ) ;
5353 } ,
5454
5555
@@ -62,14 +62,16 @@ module.exports = {
6262 * @param {Function } cb [description]
6363 * @return {[type] } [description]
6464 */
65- create : function ( values , cb ) {
65+ create : function ( values , cb , metaContainer ) {
6666
6767 var globalId = this . query . globalId ;
6868
6969 // Normalize Arguments
7070 cb = normalize . callback ( cb ) ;
7171
72- if ( Array . isArray ( values ) ) return this . createEach . call ( this , values , cb ) ;
72+ if ( Array . isArray ( values ) ) {
73+ return this . createEach . call ( this , values , cb , metaContainer ) ;
74+ }
7375
7476 // Build Default Error Message
7577 var err = 'No create() method defined in adapter!' ;
@@ -87,7 +89,7 @@ module.exports = {
8789 return cb ( err ) ;
8890 }
8991 else return cb ( null , createdRecord ) ;
90- } ) ) ;
92+ } ) , metaContainer ) ;
9193 } ,
9294
9395
@@ -100,8 +102,7 @@ module.exports = {
100102 * @param {Function } cb [description]
101103 * @return {[type] } [description]
102104 */
103- find : function ( criteria , cb ) {
104-
105+ find : function ( criteria , cb , metaContainer ) {
105106 // Normalize Arguments
106107 criteria = normalize . criteria ( criteria ) ;
107108 cb = normalize . callback ( cb ) ;
@@ -116,7 +117,7 @@ module.exports = {
116117 var adapter = this . connections [ connName ] . _adapter ;
117118
118119 if ( ! adapter . find ) return cb ( new Error ( err ) ) ;
119- adapter . find ( connName , this . collection , criteria , cb ) ;
120+ adapter . find ( connName , this . collection , criteria , cb , metaContainer ) ;
120121 } ,
121122
122123
@@ -129,7 +130,7 @@ module.exports = {
129130 * @param {Function } cb [description]
130131 * @return {[type] } [description]
131132 */
132- findOne : function ( criteria , cb ) {
133+ findOne : function ( criteria , cb , metaContainer ) {
133134
134135 // make shallow copy of criteria so original does not get modified
135136 criteria = _ . clone ( criteria ) ;
@@ -151,7 +152,7 @@ module.exports = {
151152 if ( adapter . findOne ) {
152153 // Normalize Arguments
153154 criteria = normalize . criteria ( criteria ) ;
154- return adapter . findOne ( connName , this . collection , criteria , cb ) ;
155+ return adapter . findOne ( connName , this . collection , criteria , cb , metaContainer ) ;
155156 }
156157 }
157158
@@ -164,7 +165,7 @@ module.exports = {
164165 if ( models . length < 1 ) return cb ( err ) ;
165166
166167 cb ( null , models ) ;
167- } ) ;
168+ } , metaContainer ) ;
168169 } ,
169170
170171 /**
@@ -173,7 +174,7 @@ module.exports = {
173174 * @param {Function } cb [description]
174175 * @return {[type] } [description]
175176 */
176- count : function ( criteria , cb ) {
177+ count : function ( criteria , cb , metaContainer ) {
177178 var connName ;
178179
179180 // Normalize Arguments
@@ -196,13 +197,13 @@ module.exports = {
196197 if ( ! connName ) connName = this . dictionary . count ;
197198 var adapter = this . connections [ connName ] . _adapter ;
198199
199- if ( hasOwnProperty ( adapter , 'count' ) ) return adapter . count ( connName , this . collection , criteria , cb ) ;
200+ if ( hasOwnProperty ( adapter , 'count' ) ) return adapter . count ( connName , this . collection , criteria , cb , metaContainer ) ;
200201
201202 this . find ( criteria , function ( err , models ) {
202203 if ( err ) return cb ( err ) ;
203204 var count = models && models . length || 0 ;
204205 cb ( err , count ) ;
205- } ) ;
206+ } , metaContainer ) ;
206207 } ,
207208
208209
@@ -213,7 +214,7 @@ module.exports = {
213214 * @param {Function } cb [description]
214215 * @return {[type] } [description]
215216 */
216- update : function ( criteria , values , cb ) {
217+ update : function ( criteria , values , cb , metaContainer ) {
217218 var globalId = this . query . globalId ;
218219
219220
@@ -242,7 +243,7 @@ module.exports = {
242243 return cb ( err ) ;
243244 }
244245 return cb ( null , updatedRecords ) ;
245- } ) ) ;
246+ } ) , metaContainer ) ;
246247 } ,
247248
248249
@@ -252,7 +253,7 @@ module.exports = {
252253 * @param {Function } cb [description]
253254 * @return {[type] } [description]
254255 */
255- destroy : function ( criteria , cb ) {
256+ destroy : function ( criteria , cb , metaContainer ) {
256257
257258 // Normalize Arguments
258259 cb = normalize . callback ( cb ) ;
@@ -267,7 +268,7 @@ module.exports = {
267268 var connName = this . dictionary . destroy ;
268269 var adapter = this . connections [ connName ] . _adapter ;
269270
270- adapter . destroy ( connName , this . collection , criteria , cb ) ;
271+ adapter . destroy ( connName , this . collection , criteria , cb , metaContainer ) ;
271272 }
272273
273274} ;
0 commit comments