waterline
Advanced tools
Comparing version 0.14.0-0 to 0.14.0-1
@@ -252,9 +252,7 @@ /** | ||
// | ||
// When running a `.stream()`, Waterline grabs pages (batches) of like 30 records at a time. | ||
// This is not currently configurable. | ||
// | ||
// > If you have a use case for changing this page size (batch size) dynamically, please | ||
// > create an issue with a detailed explanation. Wouldn't be hard to add, we just | ||
// > haven't run across a need to change it yet. | ||
var BATCH_SIZE = 30; | ||
// When running a `.stream()`, Waterline grabs batches (pages) of 30 | ||
// records at a time, by default. (This can be overridden using the | ||
// "batchSize" meta key.) | ||
var DEFAULT_BATCH_SIZE = 30; | ||
var batchSize = (query.meta && query.meta.batchSize !== undefined) ? query.meta.batchSize : DEFAULT_BATCH_SIZE; | ||
@@ -279,5 +277,5 @@ // A flag that will be set to true after we've reached the VERY last batch. | ||
// 50 | ||
var numRecordsLeftUntilAbsLimit = query.criteria.limit - ( i*BATCH_SIZE ); | ||
var limitForThisBatch = Math.min(numRecordsLeftUntilAbsLimit, BATCH_SIZE); | ||
var skipForThisBatch = query.criteria.skip + ( i*BATCH_SIZE ); | ||
var numRecordsLeftUntilAbsLimit = query.criteria.limit - ( i*batchSize ); | ||
var limitForThisBatch = Math.min(numRecordsLeftUntilAbsLimit, batchSize); | ||
var skipForThisBatch = query.criteria.skip + ( i*batchSize ); | ||
// |_initial offset + |_relative offset from end of previous batch | ||
@@ -303,3 +301,3 @@ | ||
// console.log('i:',i); | ||
// console.log(' BATCH_SIZE:',BATCH_SIZE); | ||
// console.log(' batchSize:',batchSize); | ||
// console.log(' query.criteria.limit:',query.criteria.limit); | ||
@@ -326,4 +324,6 @@ // console.log(' query.criteria.skip:',query.criteria.skip); | ||
// Pass through `meta` so we're sure to use the same db connection | ||
// and settings (i.e. esp. relevant if we happen to be inside a transaction) | ||
deferredForThisBatch.meta(query.meta); | ||
// and settings (esp. relevant if we happen to be inside a transaction). | ||
// > Note that we trim out `batchSize` to avoid tripping assertions about | ||
// > method compatibility. | ||
deferredForThisBatch.meta(query.meta ? _.omit(query.meta, ['batchSize']) : undefined); | ||
@@ -330,0 +330,0 @@ deferredForThisBatch.exec(function (err, batchOfRecords){ |
@@ -75,3 +75,3 @@ /** | ||
eachBatch: function(iteratee) { | ||
assert(this._wlQueryInfo.method === 'stream', 'Cannot chain `.eachRecord()` onto the `.'+this._wlQueryInfo.method+'()` method. The `.eachRecord()` method is only chainable to `.stream()`. (In fact, this shouldn\'t even be possible! So the fact that you are seeing this message at all is, itself, likely due to a bug in Waterline.)'); | ||
assert(this._wlQueryInfo.method === 'stream', 'Cannot chain `.eachBatch()` onto the `.'+this._wlQueryInfo.method+'()` method. The `.eachBatch()` method is only chainable to `.stream()`. (In fact, this shouldn\'t even be possible! So the fact that you are seeing this message at all is, itself, likely due to a bug in Waterline.)'); | ||
@@ -718,10 +718,10 @@ this._wlQueryInfo.eachBatchFn = iteratee; | ||
case 'createEach': _.extend(queryMethods, SET_Q_METHODS, FETCH_Q_METHODS, DECRYPT_Q_METHODS); break; | ||
case 'findOrCreate': _.extend(queryMethods, FILTER_Q_METHODS, SET_Q_METHODS, DECRYPT_Q_METHODS); break; | ||
case 'findOrCreate': _.extend(queryMethods, FILTER_Q_METHODS, SET_Q_METHODS, FETCH_Q_METHODS, DECRYPT_Q_METHODS); break; | ||
case 'update': _.extend(queryMethods, FILTER_Q_METHODS, SET_Q_METHODS, FETCH_Q_METHODS, DECRYPT_Q_METHODS); break; | ||
case 'updateOne': _.extend(queryMethods, FILTER_Q_METHODS, SET_Q_METHODS, DECRYPT_Q_METHODS); break; | ||
case 'updateOne': _.extend(queryMethods, FILTER_Q_METHODS, SET_Q_METHODS, FETCH_Q_METHODS, DECRYPT_Q_METHODS); break; | ||
case 'destroy': _.extend(queryMethods, FILTER_Q_METHODS, FETCH_Q_METHODS, DECRYPT_Q_METHODS); break; | ||
case 'destroyOne': _.extend(queryMethods, FILTER_Q_METHODS, DECRYPT_Q_METHODS); break; | ||
case 'destroyOne': _.extend(queryMethods, FILTER_Q_METHODS, FETCH_Q_METHODS, DECRYPT_Q_METHODS); break; | ||
case 'archive': _.extend(queryMethods, FILTER_Q_METHODS, FETCH_Q_METHODS, DECRYPT_Q_METHODS); break; | ||
case 'archiveOne': _.extend(queryMethods, FILTER_Q_METHODS, DECRYPT_Q_METHODS); break; | ||
case 'archiveOne': _.extend(queryMethods, FILTER_Q_METHODS, FETCH_Q_METHODS, DECRYPT_Q_METHODS); break; | ||
@@ -728,0 +728,0 @@ case 'addToCollection': _.extend(queryMethods, COLLECTION_Q_METHODS); break; |
{ | ||
"name": "waterline", | ||
"description": "An ORM for Node.js and the Sails framework", | ||
"version": "0.14.0-0", | ||
"version": "0.14.0-1", | ||
"homepage": "http://waterlinejs.org", | ||
@@ -6,0 +6,0 @@ "contributors": [ |
Sorry, the diff of this file is too big to display
1287794
22317