mongodb - How do I forEach on runCommand result -


i got e query typeerror: object [object object] has no method 'foreach'

how each result ?

cur = db[source_collection].runcommand('aggregate',   pipeline: pipeline   allowdiskuse: true) cur.foreach (customer) ->   db[output_collection].update({'_id': customer._id},{           '$pull': {               '$records.items': {                   $regex: /\s+/               }           }     })     

use aggregate() helper instead since in 2.6 , later, aggregate() helper returns cursor:

cur = db[source_collection].aggregate pipeline cur.foreach (customer) ->     db[output_collection].update('_id': customer._id,         '$pull':              'records.$.items':                  '$regex': /\s+/            )   

Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -