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

How to realize the operation of adding, deleting, changing and searching in mongodb

2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article introduces you how to add, delete, change and search operation in mongodb, the content is very detailed, interested friends can refer to, hope to be helpful to you.

One: Insert operation

As mentioned in the previous article, the document is stored in "Kmurv" format. If you are familiar with JSON, I believe it is easy to learn mongodb. We know that Value in JSON is easy.

It could be a "string", it could be an "array", or it could be an embedded JSON object, and the same way it works for BSON.

There are only two common forms of insert operations: "single insert" and "batch insert".

① single insert

As I said earlier, the mongo command opens a javascript shell. So the grammar of js works here, doesn't it look very good?

② bulk insert

The difference between this and "single insert", I believe you should know, because there is no "bulk insert method" provided to shell in mongodb, it doesn't matter, driver in all languages is connected.

With the mongodb internal batch insertion method, because this method is indispensable, if you have to simulate the batch insertion, you can write your own for loop, which is insert.

Two: Find operation

In daily development, we play query, the most is the second category:

①: >, > =

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