MongoDB 怎樣獲取帶數字等非正常名稱集合

2021-10-21 18:13:53 字數 400 閱讀 2079

在mongodb資料庫操作中,如果使用常規的方法獲取帶數字等非正常名稱集合,會獲取失敗,並會返回identifier starts immediately after numeric literal 錯誤。

> db.userinfo-1.drop()

2018-06-24t20:26:34.585+0800 e query    [thread1] syntaxerror: identifier starts immediately after numeric literal @(shell):1:12

可以使用getcollection()方法獲取非正常名稱的集合以進行下一步操作。

> db.getcollection("userinfo-1").drop()

true

python 獲取帶權重的隨機數

usr bin env python coding utf 8 import random def random weight weight data total sum weight data.values 權重求和 ra random.uniform 0,total 在0與權重和之前獲取乙個隨機...

MongoDB學習筆記七 MongoDB資料查詢

查詢的功能 sqlmongodb 查詢全部記錄 select from people db.people.find 查詢age 34的記錄 select from people where age 34 db.people.find 查詢age 34的記錄 select from people wh...

怎樣獲取積分

怎樣獲取積分。急 toc 你好!這是你第一次使用markdown編輯器所展示的歡迎頁。如果你想學習如何使用markdown編輯器,可以仔細閱讀這篇文章,了解一下markdown的基本語法知識。全新的介面設計,將會帶來全新的寫作體驗 在創作中心設定你喜愛的 高亮樣式,markdown將 片顯示選擇的高...