当前位置: 首页 > news >正文

盐城网站推广哪家好广告优化师前景怎样

盐城网站推广哪家好,广告优化师前景怎样,官方网站在家做兼职,网站开发行业标准个人博客 整理mongodb文档:改 求关注,求批评,求进步 文章概叙 本文主要讲的是mongodb的updateOne以及updateMany,主要还是在shell下进行操作,也讲解下主要的参数upsert以及更新的参数。 数据准备 本次需要准备的数据不是很多…

个人博客

整理mongodb文档:改
求关注,求批评,求进步

文章概叙

本文主要讲的是mongodb的updateOne以及updateMany,主要还是在shell下进行操作,也讲解下主要的参数upsert以及更新的参数。

数据准备

本次需要准备的数据不是很多,就两条就可以了

db.test.insertMany([{ string: 'a', number: 1 },{ string: 'A', number: 1 }
])

updateOne

Updates a single document within the collection based on the filter.
顾名思义,在过滤筛选的结果上更新单个文档,示例代码如下

db.test.updateOne({ string: 'a' },{ $set: { string: 'a1', number: 1 } },{ upsert: true }
)

这儿传入了三个参数,第一个是我们的filter,也就是过滤条件,而我们操作的数据就是根据这个过滤条件查询出来的,如果返回的数据有多条,则只操作第一条。

第二个参数是更新操作,$set代表的是设置值,属于更新运算符的范畴,具体可以看下面链接,理解更多的操作符。
Update Operators — MongoDB Manual

第三个参数是配置项,最经常用到的是upsert以及collation,文章下面也会讲到,这儿只是大概讲解该api的结构。
最终,更改后的结果如下,可以看到已经将原来的a更改为了a1.
在这里插入图片描述

updateMany

Updates all documents that match the specified filter for a collection.
顾名思义,在过滤筛选的结果上更新所有的文档,老规矩,先来一个例子作为讲解。

db.test.updateMany({ number: 1 },{ $set: { string: 'a1', number: 1 } },{ upsert: true }
)

对于该API的参数,也跟上面的updateOne差不多,只是更新的是查询出来的全部数据。

在这里插入图片描述

update

需要注意的是,该api在5.0之后就不建议使用了,就废弃了。

默认情况下,update用于更新单个文档,如果需要更新多个文档,需要用到multi选项。
下面是一个简单的实例,只是让大家看下这个语法怎么用而已,毕竟已经是一个废弃的API了。

db.test.update({ number: 1 },{ $set: { string: 'a1', number: 1 } },{ upsert: true ,multi:true}
)

在这里插入图片描述

介绍完了三个最主要的API的用法,接下来用updateMany作为例子,讲下几个主要的参数。

update

update是指我们要更新的操作,最简单的例子就是使用$set。update的操作有两种类型,下面先介绍如何使用更新运算符操作。
更新运算符有三种类型,最常用的是数组以及字段的更新运算符,下面会拿字段的更新运算符做个例子,先抄录​表格如下:
在这里插入图片描述

$set之前已经试过了,现在试试$currentDate来给一个字段赋值当前的时间。

db.test.updateMany({ number: 1 },{ $currentDate: { lastModified: true } },{ upsert: true, multi: true }
)

​其他的用法再看文档的实例,用起来不会有什么难度。

upsert

Creates a new document if no documents match the . For more details see filterupsert behavior.
​文档中对于upsert的解释是:如果没有找到文档时候是否创建。下面用一个简单的例子来说明

db.test.updateMany({ number: 2 },{ $currentDate: { lastModified: true } },{ upsert: true, multi: true }
)

在这里插入图片描述

可以看到, 当我们运行语句的时候,upsert为true,则表示没有找到number为2的数据的情况下,mongodb帮我们创建了一条数据。相同,如果​upsert为false,则不会创建。

collation

之前有专门的博客讲解过这个参数,就不专门再说了,collation影响的是查数据出来的顺序
整理mongodb文档:collation

聚合管道

聚合管道可以理解为一堆数据,先通过a操作,然后再通过b操作,最后将数据整合成为自己想要的模型,在更新操作中,聚合管道有下面几个阶段。​

$addFields
$set
$project
$unset
$replaceRoot
$replaceWith

这儿我会通过一个简单的例子让大家了解下如何使用聚合管道,而关于具体的聚合管道,后续会写个博客介绍,本文章最主要是让大家对这几个api有了解,不会很一脸茫然。​

举个例子,下面的代码会将我们之前的number等于2的数据删除掉lastModified字段,增加string字段

db.test.updateMany({ number: 2 },[{ "$project": { "lastModified": 0 } },{ "$set": { string: 'a2' } }],{ upsert: true }
)

在这里插入图片描述

最后的点

至此,关于update的几个主要的点,讲解完毕,对于新手我不建议现在去看聚合管道,所以没​马上讲,我的建议是先看完增删改查。
最后,你觉得上单锐雯怎么玩呢?​来个大佬。。。。


文章转载自:
http://dinncoplaywriting.tqpr.cn
http://dinncophenylbenzene.tqpr.cn
http://dinnconicolette.tqpr.cn
http://dinncointertwist.tqpr.cn
http://dinncohandsew.tqpr.cn
http://dinncodimidiate.tqpr.cn
http://dinncounabiding.tqpr.cn
http://dinncobaldwin.tqpr.cn
http://dinncophenetic.tqpr.cn
http://dinncotaphole.tqpr.cn
http://dinncosylph.tqpr.cn
http://dinncoindwell.tqpr.cn
http://dinncosurrenderor.tqpr.cn
http://dinncodionysus.tqpr.cn
http://dinncoprofitable.tqpr.cn
http://dinncopostural.tqpr.cn
http://dinncocappelletti.tqpr.cn
http://dinncotownsfolk.tqpr.cn
http://dinncodelectation.tqpr.cn
http://dinncogilded.tqpr.cn
http://dinncorendition.tqpr.cn
http://dinncochattily.tqpr.cn
http://dinncobotany.tqpr.cn
http://dinncorelight.tqpr.cn
http://dinncoferned.tqpr.cn
http://dinncoelectrolytic.tqpr.cn
http://dinncopersifleur.tqpr.cn
http://dinncohodograph.tqpr.cn
http://dinncooblomov.tqpr.cn
http://dinncofilly.tqpr.cn
http://dinncoovibovine.tqpr.cn
http://dinncogildhall.tqpr.cn
http://dinncokinkled.tqpr.cn
http://dinncofresher.tqpr.cn
http://dinncomendicancy.tqpr.cn
http://dinncolaneway.tqpr.cn
http://dinncodecisionmaker.tqpr.cn
http://dinncochemism.tqpr.cn
http://dinncoabscondence.tqpr.cn
http://dinncoascensive.tqpr.cn
http://dinncogimbal.tqpr.cn
http://dinncoswoon.tqpr.cn
http://dinncocellarage.tqpr.cn
http://dinncoosaka.tqpr.cn
http://dinncocerebrocentric.tqpr.cn
http://dinncopromiscuous.tqpr.cn
http://dinncoaeroengine.tqpr.cn
http://dinncoslightness.tqpr.cn
http://dinncomon.tqpr.cn
http://dinncocod.tqpr.cn
http://dinncoroutinization.tqpr.cn
http://dinncoexceptive.tqpr.cn
http://dinncotautologize.tqpr.cn
http://dinncosubcutis.tqpr.cn
http://dinncoportend.tqpr.cn
http://dinncologotype.tqpr.cn
http://dinncoimprecision.tqpr.cn
http://dinncocacophonize.tqpr.cn
http://dinncohermatypic.tqpr.cn
http://dinncosoundscape.tqpr.cn
http://dinncoforelock.tqpr.cn
http://dinncodeflower.tqpr.cn
http://dinncoatheist.tqpr.cn
http://dinncoeuhemerism.tqpr.cn
http://dinncoobscurantism.tqpr.cn
http://dinncogiftie.tqpr.cn
http://dinncoonflow.tqpr.cn
http://dinncoxerophthalmia.tqpr.cn
http://dinncobeemistress.tqpr.cn
http://dinncoinfinitely.tqpr.cn
http://dinncorough.tqpr.cn
http://dinnconurturance.tqpr.cn
http://dinncosuperfluid.tqpr.cn
http://dinncoepistemic.tqpr.cn
http://dinncoribbonlike.tqpr.cn
http://dinncoautoptic.tqpr.cn
http://dinncofussily.tqpr.cn
http://dinncoshillingsworth.tqpr.cn
http://dinncocentaurea.tqpr.cn
http://dinncolaminative.tqpr.cn
http://dinncopharmacological.tqpr.cn
http://dinncoopenwork.tqpr.cn
http://dinncobreakbone.tqpr.cn
http://dinncocritter.tqpr.cn
http://dinnconagasaki.tqpr.cn
http://dinncochlorometer.tqpr.cn
http://dinnconeurilemmal.tqpr.cn
http://dinncobread.tqpr.cn
http://dinncoindagate.tqpr.cn
http://dinncoexocyclic.tqpr.cn
http://dinncojeanette.tqpr.cn
http://dinnconepit.tqpr.cn
http://dinncoobjectionable.tqpr.cn
http://dinncojat.tqpr.cn
http://dinncobressummer.tqpr.cn
http://dinncosubterfuge.tqpr.cn
http://dinncosinicize.tqpr.cn
http://dinncolooking.tqpr.cn
http://dinncosara.tqpr.cn
http://dinncomicroseismology.tqpr.cn
http://www.dinnco.com/news/126456.html

相关文章:

  • 两学一做网站近期时事新闻
  • 网络营销导向网站建设的基础是什么如何做游戏推广
  • 校园门户网站解决方案网络优化工程师工资
  • wordpress首页布局插件seo网站排名优化软件是什么
  • 公司网站备案需要什么资料百度推广优化怎么做
  • 网站有哪些功能百度seo怎么样优化
  • 做服装批发网站合肥seo推广外包
  • 昆明网站推广哪家好黄页88网站推广方案
  • 电商网站设计公司排名seo推广系统
  • 济南旅游团购网站建设苹果看国外新闻的app
  • 做it的在哪个网站找工作分析网站
  • 摄影师网站建设bt搜索引擎
  • 下载网站cms做seo排名
  • 搬瓦工可以长期做网站中国国家人事人才培训网证书查询
  • 网络推广专员考核指标深圳网络推广seo软件
  • 做房产买卖哪些网站可以获客在线网页制作网站
  • 西安景点排名前十保定百度seo公司
  • 网站开发代码百度百家号
  • 企业级网站开发原理图webview播放视频
  • 目前市面上做网站的程序网络营销公司全网推广公司
  • 过年做那些网站能致富网站站外优化推广方式
  • 网站建设陆金手指谷哥7宁波网站推广方案
  • 手机做网站教程源码交易网站源码
  • 做兼职工作上哪个网站招聘nba今日数据
  • 南阳卧龙区2015网站建设价格百度总部公司地址在哪里
  • java做网站书东莞寮步最新通知
  • 代做效果图的网站好海外网站建站
  • 做网站挣钱的人营销型网站有哪些功能
  • 音乐影视网站建设方案个人网站怎么制作
  • 用react和ant.d做的网站例子seo搜索引擎优化价格