C++ 下MongoDB使用

來源:互聯網
上載者:User

C++ 下MongoDB使用:

增加欄位
{$set:{"欄位":1}})
刪除欄位
{$unset:{"欄位":1}})

查詢數組中的元素
{"關鍵字":{$all:["位置","其他"]}}

增加數組元素(重複的不會加)
{"$addToSet":{"關鍵字":{"$each":["位置","其他"]}}}


經緯度查詢(經度在前,緯度在後)
從近到遠排序
{"經緯度":{"$near":[28.0988562,109.3167951]}}

以座標為中心(經度,緯度,距離)
{"地址資訊.經緯度":{"$within":{"$center":[[28.0988562,109.3167951],0.1]}}}

相關文章

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.