校园春色亚洲色图_亚洲视频分类_中文字幕精品一区二区精品_麻豆一区区三区四区产品精品蜜桃

主頁 > 知識庫 > mongodb exception: $concat only supports strings, not NumberInt32解決辦法

mongodb exception: $concat only supports strings, not NumberInt32解決辦法

熱門標簽:智能電銷機器人銷售話術 兗州電話外呼營銷系統 沈陽營銷電銷機器人招商 高德地圖標注商戶位置 南京400電話怎樣辦理 福州電銷機器人源代碼 企業智能外呼系統價格多少 徐州ai電銷機器人原理 機器人外呼系統軟件存在問題

今天在用mongodb操作aggregation的時候出現這個問題,我是想格式化日期,例如”2013-10-17 04:41:37 UTC”變成”10月17日”,

復制代碼 代碼如下:

'fdate' => { '$concat' => ['$date.month', '月', '$date.day', '日'] }

出現 exception: $concat only supports strings, not NumberInt32

原來$concat只能操作字符串,不支持數字類型,解決辦法是用$substr

復制代碼 代碼如下:

$date形如'2013-10-13 11:17:18 UTC'

'fdate' => { '$concat' => [ {$substr=>['$date', 5, 2]}, '月', {$substr=>['$date', 8, 2]}, '日'] }


$substr接受兩個參數,一個是字符串的起點,一個是截取的字符串的長度。

您可能感興趣的文章:
  • go語言中的interface使用實例
  • Go語言interface詳解
  • mongodb錯誤tcmalloc: large alloc out of memory, printing stack and exiting解決辦法
  • golang實現unicode轉換為字符串string的方法
  • Go語言string,int,int64 ,float之間類型轉換方法

標簽:鶴崗 吉安 本溪 景德鎮 邯鄲 大理 丹東 昭通

巨人網絡通訊聲明:本文標題《mongodb exception: $concat only supports strings, not NumberInt32解決辦法》,本文關鍵詞  mongodb,exception,concat,only,;如發現本文內容存在版權問題,煩請提供相關信息告之我們,我們將及時溝通與處理。本站內容系統采集于網絡,涉及言論、版權與本站無關。
  • 相關文章
  • 下面列出與本文章《mongodb exception: $concat only supports strings, not NumberInt32解決辦法》相關的同類信息!
  • 本頁收集關于mongodb exception: $concat only supports strings, not NumberInt32解決辦法的相關信息資訊供網民參考!
  • 推薦文章
    主站蜘蛛池模板: 连州市| 黄冈市| 米易县| 奉新县| 内黄县| 永兴县| 江阴市| 石渠县| 天全县| 诸城市| 高淳县| 融水| 娄底市| 四会市| 龙口市| 永丰县| 临洮县| 岳阳市| 扶绥县| 富源县| 阳原县| 巴东县| 武胜县| 涡阳县| 收藏| 淮阳县| 永丰县| 托克逊县| 车致| 正蓝旗| 汝城县| 梅河口市| 临桂县| 马公市| 涡阳县| 三明市| 鲁山县| 紫金县| 宜章县| 封丘县| 搜索|