Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var DBItem = require('Fallback.DBItem');
- DBItem.getDataBase().items.count().then(function(count)
- {
- console.log('initial count: ' + count);
- var offset = 0
- , promiseArray = [];
- while(offset < count)
- {
- DBItem.getDataBase().items.offset(offset).limit(100).toArray().then(bulkPutItems);
- offset += 100;
- }
- }).catch(console.log)
- function bulkPutItems(items)
- {
- items = _.map(items, function(item)
- {
- item.internalid = item.internalid + '_2';
- return item;
- });
- return DBItem.getDataBase().items.bulkPut(items).then(console.log);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement