February 2012 Entries

MongoDB index scripting
Say you liked the indexes you created on system A and wanted them on system B. Say you are a horrible typist. Say you are reading this blog, and are good at COPY+PASTE. @ECHO OFF SET HOST=eqcmongo01.eq.colo/ SET DB=Photologica mongo %HOSt%%DB% --quiet --eval "db.system.indexes.find({'k... print(c.ns.replace('%DB%','... + '.ensureIndex('); printjson(c.key); print( ');') ;})" The recipe is: Run mongo shell in quiet mode. Query out the indexes except the "natural" ......

Posted On Monday, February 20, 2012 1:56 PM | Comments (3)