为什么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
最满意答案
我用了
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>
相关问答
更多-
通过本地客户端程序获取服务器mysql数据库信息[2023-04-27]
ajax -
你永远不会输入你的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", ...
-
AJAX间隔刷新?(AJAX Interval Refresh?)[2022-02-11]
考虑使用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 ...
-
Ajax发布没有刷新(Ajax post without refresh)[2023-10-19]
我用了 type: "GET", url: "http://stackoverflow.com/questions/32554239/ajax-post-without-refresh", 而不是你的 type: "POST", url: "http://****/new/action.php", 它工作正常。 (只需点击“运行代码段”,它会显示错误,因为该网址不支持跨域) $(document).ready(function() { $("form#iscrizion ... -
页面刷新时的Ajax POST?(Ajax POST on page refresh?)[2022-03-07]
我最终找到了答案,所以我想把它发布在这里,希望有人可能会发现它有用。 在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 ,你将 ...
-
MVC Core使用ajax发布数据并刷新页面上的部分(MVC Core use ajax to post data and refresh a section on the page)[2023-08-07]
如果您想用新添加的产品更新页面的某个部分,可以采用多种方式进行 1.用新的ajax调用重新加载整个列表 当您的ajax调用保存新产品成功时,您可以再次调用ajax调用以重新加载整个列表。 您将在第一次ajax调用的done事件中进行此调用。 例如,假设您以表格数据形式在页面中呈现产品列表 -
DataTables可以如https://datatables.net/examples/data_sources/server_side.html和https://datatables.net/reference/option/ajax中的示例所示进行提供 如下更改您的代码: /* SHOW - message */ sweetAlert({ title: 'Are You Sure?', htm ...