首页 \ 问答 \ {$ unset:{field:1}}中1的含义是什么(What does 1 mean in { $unset : { field : 1} })

{$ unset:{field:1}}中1的含义是什么(What does 1 mean in { $unset : { field : 1} })

在下面的代码片段中,我能够从具有不同参数的集合中删除两个关键字段(即One为1,另一个为0)。

> i = { name : 'name', age : 25, gender : 'female' };
{ "name" : "name", "age" : 25, "gender" : "female" }
> db.users.insert(i)
> db.users.find()
{ "_id" : ObjectId("4e8b5b5e654f46ccc304e44e"), 
  "name" : "name", "age" : 25, "gender" : "female" }
> db.users.update({ name : 'name'}, 
                  {$unset : {age : 1, gender : 0}}) // check here
> db.users.find()
{ "_id" : ObjectId("4e8b5b5e654f46ccc304e44e"), "name" : "name" }
> 

参考:MongoDB $ unset

问题>以下手册中1的用法是什么?

{$ unset:{field:1}}


In the following snippet, I am able to remove two key fields from a collection with different parameters (i.e. One is 1 and the other is 0).

> i = { name : 'name', age : 25, gender : 'female' };
{ "name" : "name", "age" : 25, "gender" : "female" }
> db.users.insert(i)
> db.users.find()
{ "_id" : ObjectId("4e8b5b5e654f46ccc304e44e"), 
  "name" : "name", "age" : 25, "gender" : "female" }
> db.users.update({ name : 'name'}, 
                  {$unset : {age : 1, gender : 0}}) // check here
> db.users.find()
{ "_id" : ObjectId("4e8b5b5e654f46ccc304e44e"), "name" : "name" }
> 

Reference: MongoDB $unset

Question> What is the usage of 1 in the following manual?

{ $unset : { field : 1} }


原文:https://stackoverflow.com/questions/7652990
更新时间:2023-06-28 21:06

最满意答案

Cookie在应用程序设置中的“App Domains”定义的域之一上设置。 我不确定如果你列出多个域但它可能是多么精确,但SDK可能选择最接近当前域的域。

因此,如果您将其设置为www.domain.com则会在此处设置Cookie,并且不会将其发送到static.domain.com

另外FYI没有记录,但FB.init cookie参数可以设置为string值,即将设置域cookie。 (我不推荐在官方Facebook JS-SDK存储库更新之前在生产中使用它,实际代码表明这是可能的或在文档中说明的内容)


Cookies are set on one of domains defined by "App Domains" in application settings. I'm not sure how exactly it behaves in case you list more than one domain but probably domain closest to the current one is chosen by SDK.

So if you'll set it to www.domain.com cookies will be set here and will not be sent to static.domain.com.

Also FYI it is not documented but cookie parameter of FB.init can be set to string value which is domain cookies will be set on. (I do not recommend using it in production before official Facebook JS-SDK repository updated with actual code that indicates this is possible or something stated about that in documentation)

相关问答

更多
  • 是的,这也是SEO所需要的东西。 同一内容的多个网址不是一件好事。 您需要在下面写的htaccess文件中进行更改。 RewriteBase / RewriteCond %{HTTP_HOST} ^example.com [NC] RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301] Yes that's what is needed and good for SEO too. Multiple url for same content is not ...
  • 它更可能是缓存DNS。 您的子域的DNS记录将具有以秒为单位的TTL(生存时间),它告诉下游服务器检查源的任何更改的频率。 通常在14400(4小时)到86400(24小时)左右。 当您的计算机首次查询DNS以获取subdomain.example.com的IP地址时,它将不会再次检查TTL中指定的时间。 一旦过去,删除的子域将不再解析为IP。 清除浏览器缓存可能会清除dns缓存,尽管我对此表示怀疑。 这更有可能与TTL流逝同时发生。 It's more likely to be cached DNS. Y ...
  • 1)问题是Wordpress不会在用户上传的文件中发送缓存信息,W3 Total Cache也无法修复此问题。 这里有一些例子来解决这个问题: http : //www.askapache.com/hacking/speed-site-caching-cache-control.html 2)为避免浏览器向您的cdn子域发送cookie,您必须确保该站点在www.yourdomain.com而非yourdomain.com上启动。 当访问者仅输入域名时,将访问者重定向到www.yourdomain.com。 ...
  • 将域设置为“www.example.com”或“.www.example.com”将使cookie仅在www子域中可用。 如果您想在example.com的所有子域(包括example.com本身)上提供cookie,那么您可以将其设置为“.example.com” 。 Setting the domain to 'www.example.com' or '.www.example.com' will make the cookie only available in the www subdomain. ...
  • 来自http://social.msdn.microsoft.com/Forums/ie/en-US/3e9f3c92-8724-4f41-9be3-34c2877ada0f/ie11-session-id-in-url Microsoft已更改IE的用户代理字符串,因此不再将其检测为IE。 在此期间,您可以通过编辑web.config来更改默认行为。 您应该在部分中执行此操作,而不是在sessionState中设置cookie处理。
  • 有一个facebook python SDK的修改版本,它支持OAuth 2.0并在github上解析fbsr_ cookie: https://gist.github.com/1190267 您可以查看代码以了解如何解析cookie或让该文件为您完成工作。 There is a modified version of the facebook python SDK which supports OAuth 2.0 and parsing of the fbsr_ cookie on github here ...
  • Cookie在应用程序设置中的“App Domains”定义的域之一上设置。 我不确定如果你列出多个域但它可能是多么精确,但SDK可能选择最接近当前域的域。 因此,如果您将其设置为www.domain.com则会在此处设置Cookie,并且不会将其发送到static.domain.com 。 另外FYI没有记录,但FB.init cookie参数可以设置为string值,即将设置域cookie。 (我不推荐在官方Facebook JS-SDK存储库更新之前在生产中使用它,实际代码表明这是可能的或在文档中说明 ...
  • 编辑: 在为map.ninux.org设置cookie时,不能将static.map.ninux.org cookie设置为free,因为static.map.ninux.org将继承map.ninux.org中的所有cookie(并且您没有任何改变这种行为的机会)。 您可能希望将cookiefree域名更改为static-map.ninux.org。 在这种情况下,_setDomainName是'auto'的默认设置将正常工作。 Edit: You can't make static.map.ninux. ...
  • 对于会话cookie,您需要覆盖cookie参数 : 所以你可以使用: ini_set('session.cookie_domain', '.website.com'); 要么 session_set_cookie_params(0, '/', '.website.com'); '。' 在前面使它可以在域和子域下访问。 注意:您必须从浏览器中删除您正在使用的域的所有现有Cookie,以便可以正确地重新初始化它们以便工作。 For session cookies you need to override ...
  • 您只需要设置另一个域。 它可以指向相同的webapps。 只需确保您不会在此新域上删除Cookie。 例如,您的主站点是 www.example.com 你可以拥有另一个域名 static.example.com 对于无cookie的静态资源。 他们可以指向相同的主机,转到相同的Servlet。 您只需要在应用中确保不丢弃这些静态内容的Cookie。 编辑:假设您的静态内容由Tomcat中的默认servlet提供,您不必执行任何操作。 它不会为您丢弃cookie,因此您的新域名应该不含cook ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。