MongoDB入門三

來源:互聯網
上載者:User

標籤:操作   time   position   weight   mes   分享   create   技術   nbsp   

MongoDB欄位問題  增刪查改操作


刪除一列操作
db.RiderReaTimePositon.update({},{$unset:{‘CreateTime‘:‘‘}},false,true)
db.RiderReaTimePositon.update({},{$unset:{‘刪除欄位‘:‘‘}},false,true)
新增一列操作
db.RiderReaTimePositon.update({},{$set:{‘demo‘:‘‘}},false,true)
db.RiderReaTimePositon.update({},{$set:{‘新增欄位‘:‘‘}},false,true)
MongoDB解決方案:http://www.cnblogs.com/mengfanrong/p/5185908.html
http://www.lai18.com/cate/99.html

 

//查詢資料
db.testcol.find()

//插入資料
db.RiderPosition.insert({‘name‘:‘Jemm‘,‘age‘:‘26‘,‘weight‘:‘140‘,‘CreateTime‘:‘2017-08-02‘})

db.RiderPosition.insert({‘name‘:‘Jim‘,‘age‘:‘28‘,‘weight‘:‘156‘,‘CreateTime‘:‘2017-08-02 15:25:20‘})

db.RiderPosition.find()

//根據時間查詢
db.RiderPosition.find().sort({‘CreateTime‘:-1})

 

MongoDB定時任務
db.RiderPosition.find()

db.log_event.insert({‘createAt‘:new Date(),‘logEvent‘:2,‘logMessage‘:‘success‘})

db.log_event.find()

db.log_event.createIndex({‘expireAt‘:1},{expireAfterSeconds:0})

db.log_event.insert({‘expireAt‘:new Date(‘August 2,2017 19:55:00‘),‘logEvent‘:2,‘logMessage‘:‘success‘})

MongoDB入門三

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.