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

Daily work of Mongo

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

Share

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

Mongo login:

. / mongo ip:port/lych-lych is dbname-use lych,db,show collections

Db.auth ("rds", "abc123")-abc123 is passwd

Db.collection.find ()

{field1:, field2:...}

Db.collection.update ()

(,-query: update query condition, similar to sql update query where condition.

The object of update and some updated operators (such as $, $inc...), etc., can be understood as set in sqlplus

{upsert:,-if there is no record of update, whether to insert objNew, (true,false:

Do not insert by default)

Multi:,-mongodb defaults to false. Only the first record found will be updated. If this parameter is true, multiple records will be updated according to the condition.

WriteConcern:})-optional, the level at which the exception is thrown

Db.abc.update ({"ipad": "/ ^ 12.80 /"}, {$set: {"code": 6000}}, {muti:true})-"ipad": / 12.80 $/ ends with 12.80

Db.collection.remove ()

Db.abc.remove ({"ipad": "/ ^ 12.80 /"})

Mongoexport

. / mongoexport-h ip:port-d rds-u lych-c lych-o lych.dat

. / mongoimport-h ip:port-d rds-u lych-c lych lych.dat

-the document will then be refined for each content.

Sometimes it is easy to report an error when the spliced insert script is placed in the foreground, but it is normal to put the js file for import:

. / mongo ip:port/rds-u lych-p lych000 hic.js

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