首页 \ 问答 \ 为什么mongoDB使用objectID?(Why mongoDB uses objectID?)

为什么mongoDB使用objectID?(Why mongoDB uses objectID?)

{ "_id" : ObjectId("4c2209f9f3924d31102bd84a"), "name" : "mongo" }

objectId究竟是什么目的? 这是使用时间戳生成的大数字。

如果我看到任何nosql是键值,我用键查询值。

这里我们使用key和value作为数据并使用find()函数。

那么,我想知道什么时候我们真的需要objectid? 授予用户访问权限以查看对象ID值的原因是什么?

阅读文档后,一个基本问题是mongo DB作为哈希表类型实现?


{ "_id" : ObjectId("4c2209f9f3924d31102bd84a"), "name" : "mongo" }

what exactly is the purpose of objectId? It's a big number that is generated using a timestamp.

If I see any nosql which is key-value, I query with key the value.

Here we use key and value in the as the data and use find () function.

So, I am trying to understand when we really need the objectid? What are the reasons behind that giving access to the user to view the value of the object ID?

After reading the docs, one basic question is mongo DB as hash table type implementation?


原文:https://stackoverflow.com/questions/6560928
更新时间:2022-07-05 07:07

最满意答案

我用了

  type: "GET",
  url: "http://stackoverflow.com/questions/32554239/ajax-post-without-refresh", 

而不是你的

   type: "POST",
  url: "http://****/new/action.php",  

它工作正常。 (只需点击“运行代码段”,它会显示错误,因为该网址不支持跨域)

$(document).ready(function() {  
  $("form#iscrizione").submit(function(){   
    var ordine = $("#ordine").val();  
    var cognome = $("#cognome").val();
    $.ajax({  
      type: "GET",
      url: "http://stackoverflow.com/questions/32554239/ajax-post-without-refresh",  
      data: "cognome=" + cognome + "&ordine=" + ordine,
      dataType: "html",
      success: function(risposta) {  
        $("div#risposta").html(risposta);  
        alert("ok!");
      },
      error: function(){
              alert("Chiamata fallita!!!");
}
    }); 
    return false;  
  });
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<form id="iscrizione"> 
  
  <input type="text" value="get" id="cognome"><input type="text" value="get" id="ordine"><input type="submit" value="get"></form><div id="risposta"></div>


I used

  type: "GET",
  url: "http://stackoverflow.com/questions/32554239/ajax-post-without-refresh", 

instead of your

   type: "POST",
  url: "http://****/new/action.php",  

AND it works fine. (Just click on "Run snippet", it shows an error because the url doesn't support cross-domain)

$(document).ready(function() {  
  $("form#iscrizione").submit(function(){   
    var ordine = $("#ordine").val();  
    var cognome = $("#cognome").val();
    $.ajax({  
      type: "GET",
      url: "http://stackoverflow.com/questions/32554239/ajax-post-without-refresh",  
      data: "cognome=" + cognome + "&ordine=" + ordine,
      dataType: "html",
      success: function(risposta) {  
        $("div#risposta").html(risposta);  
        alert("ok!");
      },
      error: function(){
              alert("Chiamata fallita!!!");
}
    }); 
    return false;  
  });
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<form id="iscrizione"> 
  
  <input type="text" value="get" id="cognome"><input type="text" value="get" id="ordine"><input type="submit" value="get"></form><div id="risposta"></div>

相关问答

更多
  • 你永远不会输入你的ajax调用的success函数:你已经将dataType设置为json所以jQuery期望json返回。 但是,您正在发回html。 你应该从你的ajax调用中删除dataType: "json", : $.ajax({ type: "POST", url: "auction-handler.php", // Or remove this, or send json back // dataType: "json", ...
  • 考虑使用setTimeout来代替 - 它更可靠。 当窗口没有焦点时, setInterval定时器可以堆叠,然后当它再次获得焦点时,它们都会立即运行。 使用setTimeout还可以确保如果第一个AJAX请求由于某种原因而阻塞,则不会获得排队的多个AJAX请求。 要立即开始循环,请使用环绕该函数的IIFE(“立即调用的函数表达式”): (function update() { $.ajax({ ... // pass existing ...
  • 这只是一个例子 $.ajax({ url: '@Url.Action("NewGridView", "Test")', type: "Post", data: { sampleItem: sampleItem, sampleCode: sampleCode, sampledescription: sampledescription }, dataType: 'json', success: function ...
  • 我用了 type: "GET", url: "http://stackoverflow.com/questions/32554239/ajax-post-without-refresh", 而不是你的 type: "POST", url: "http://****/new/action.php", 它工作正常。 (只需点击“运行代码段”,它会显示错误,因为该网址不支持跨域) $(document).ready(function() { $("form#iscrizion ...
  • 我最终找到了答案,所以我想把它发布在这里,希望有人可能会发现它有用。 在success()回调中,我添加了以下代码: $("#subscribe-form")[0].reset(); 谢谢,加文 i eventually found the answer to this, so thought i'd post it on here, and hopefully someone may find it useful in the future. Within the success() callback, ...
  • 您正在向整个文档发送XMLHTTPRequest而不是PHP的一部分(正如我从您的问题中理解的那样,您需要的是后者)。 另外,您将请求发送到同一当前页面info.php ,最好通过将PHP代码分成两部分来分离问题(一个是呈现初始形式,另一个是用于处理服务器端的部分) )。 因此,AJAX将返回info.php所有结果(静态标记+生成的标记)并返回所有最终HTML并将其加载到.ld 。 我建议创建两个文件: form.php和process-form.php当form.php ready文档ready ,你将 ...
  • 如果您想用新添加的产品更新页面的某个部分,可以采用多种方式进行 1.用新的ajax调用重新加载整个列表 当您的ajax调用保存新产品成功时,您可以再次调用ajax调用以重新加载整个列表。 您将在第一次ajax调用的done事件中进行此调用。 例如,假设您以表格数据形式在页面中呈现产品列表
    然后,当您的登录响应成功时,您可以重新加载导航栏: $('#ajax-nav').load("some url that returns the html of the navbar"); 然后你只需要一条通向Controller的路线,该路由器可以根据用户登录状态(登录或访客)生成导航栏。 通过此过程,您可以在成功登录等特定事件后用新生成的导航栏完全替换导航栏的内容,或者甚至可以 ...
  • DataTables可以如https://datatables.net/examples/data_sources/server_side.html和https://datatables.net/reference/option/ajax中的示例所示进行提供 如下更改您的代码: /* SHOW - message */ sweetAlert({ title: 'Are You Sure?', htm ...

相关文章

更多

最新问答

更多
  • 获取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的基本操作命令。。。