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
Post a Comment