mongodb - mongo shell same command across multiple collections -


i trying following date conversion on multiple collections:

db.u201409.find().snapshot().foreach(   function (e) {     e.sta = new date(e.start);     e.sto = new date(e.stop);     db.u201409.save(e);   } ) 

as can seen, 1 collection, namely "u201409". format uyyyymm. need execute exact same command collections 201409 until 201604, u201409, u201410, u201411, u201412, u201501, ..., u201604.

is possible using shell script, , if so, how can accomplished?

the mongo shell command language javascript, write javascript:

var = ["u201401", "u201402"...] (var = 0; < a.length; i++) {     db[a[i]].find().snapshot().foreach(         ...     ) } 

Comments

Popular posts from this blog

html - How to set bootstrap input responsive width? -

javascript - Highchart x and y axes data from json -

javascript - Get js console.log as python variable in QWebView pyqt -