1. 程式人生 > >Mongo DB 批量增加相同欄位

Mongo DB 批量增加相同欄位

語句:db.getCollection('表名').update({},{$set:{'新增欄位':欄位初始值}},{multi:true})

指定型別:db.getCollection('feed_video_v2').update({},{$set:{'orderNum':NumberInt('0')}},{multi:true})

NumberInt 指定是int型別,如果不指定,我這條語句生成的是double型別