Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

MongoDB Tips on how to use underlined set name queries

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

> show collections

_ test

_ test_serial_number

_ test_message_send

Inventory

>

> db._test_message_send.find ()

2017-09-29T01:52:37.612+0000 E QUERY [thread1] TypeError: db._wechat_message_send is undefined:

@ (shell): 1:1

> db._test_message_send.count ()

2017-09-29T01:53:25.302+0000 E QUERY [thread1] TypeError: db._wechat_message_send is undefined:

@ (shell): 1:1

GetCollection should be used when querying underlined collection names, for example:

> db.getCollection ('_ test_message_send') .count ()

2562

> db.getCollection ('_ test_message_send') .findOne ()

{

"_ id": "93e4cc65502344f584bfb385f94dde35"

"_ class": "com.base.entities.WechatMessageSend"

"type": 4

"status": 3

"memberId": "863eee3694fc45"

"openId": "oB3wuwViNwa2G2NpOCdjMSvFJCcY"

"templateId": "2KKEiTYulLq4RxRudlNuX"

"messageId": "7a33b0f20e2e43c"

CreateTime: ISODate ("2016-07-19T00:23:37.346Z")

}

Rename the collection name:

> db.getCollection ('_ test') .renameCollection ("_ test_bak20171011")

{"ok": 1}

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report