發表文章

目前顯示的是 12月, 2016的文章

mongodb aggregate 筆記

aggregate 為mongodb整合計算的function 以下引用官網的例子: https://docs.mongodb.com/manual/reference/operator/aggregation/match/ { "_id" : ObjectId ( "512bc95fe835e68f199c8686" ), "author" : "dave" , "score" : 80 , "views" : 100 } { "_id" : ObjectId ( "512bc962e835e68f199c8687" ), "author" : "dave" , "score" : 85 , "views" : 521 } { "_id" : ObjectId ( "55f5a192d4bede9ac365b257" ), "author" : "ahn" , "score" : 60 , "views" : 1000 } { "_id" : ObjectId ( "55f5a192d4bede9ac365b258" ), "author" : "li" , "score" : 55 , "views" : 5000 } { "_id" : ObjectId ( "55f5a1d3d4bede9ac365b259" ), "author" : "annT" , "score" : 60 , "views" : 50 } {

Jquery在form表單利用submit取得所有的inputs

按下submit後將表格內的所有input讀取出並轉成json格式 示意表格(簡化): <form name="demo-form" id="test">     <div>         <label>Full Name  :</label>         <input name="fullname" />    </div>  <div>         <label>Email :</label>         <input name="email" />    </div>  <div>         <label>Address  :</label>         <input name="address" />    </div>  <div>         <label>Phone :</label>         <input name="phone" />    </div>  <div>         <label>Fax:</label>         <input name="fax" />    </div>  <div>        <button type="submit"></button>    </div> </form> Jquery code: $( "#test" ).submit(function(){ var $inputs = $('#test :input').not(':button');   //如果只有input會抓到button的值 va