- 浏览: 258114 次
- 性别:
- 来自: 上海
文章分类
- 全部博客 (263)
- mysql (5)
- boost (6)
- 工具 (10)
- IT生活 (7)
- 多线程 (3)
- Ruby (15)
- php (2)
- MongoDB (39)
- 移动互联网 (2)
- 测试 (8)
- c++ (28)
- 书 (1)
- 网站 (3)
- 网络编程 (14)
- 开源软件 (1)
- 分布式计算 (1)
- 得得得 (1)
- php,wordpress (1)
- error (5)
- 编译 (2)
- 学习 (1)
- 杀毒软件 (1)
- dd (0)
- linux (21)
- 数据库 (1)
- STL (1)
- c++/c (5)
- 软件设计 (1)
- 操作系统 (4)
- 库 (2)
- win32 (1)
- s (0)
- openssl (1)
- perl (2)
- debug (1)
- windows (4)
- python (12)
- windows 防火墙 (1)
- vs (1)
- vim (2)
- vc (1)
- 浏览器插件的危害 (1)
- curl (0)
- 判断手机号码合法性的库 (0)
- 地址备注 (0)
- 安装 File::Slurp (1)
- cenos (2)
- shell (1)
- linunx (1)
- internet (1)
- software (1)
- widows (1)
- linux io (1)
- nginx (2)
- 算法 (2)
- google (1)
- protobuf (2)
- tengine (1)
- tools (1)
- lua (2)
- liunx (1)
- vcard (1)
- lua-iconv (1)
- 网络 (2)
- teat (0)
- ldconfig linux (0)
- awk (0)
- grep (0)
- windws (2)
- linux 命令 (1)
- tcp dump (1)
- vmware (1)
- question2answer (2)
- mongdb (1)
- 正则 (1)
- OCR (2)
- Windows Server (1)
最新评论
http://docs.mongodb.org/manual/reference/command/getLastError/
getLastError¶
The getLastError command returns the error status of the last operation on the current connection. By default MongoDB does not provide a response to confirm the success or failure of a write operation, clients typically use getLastError in combination with write operations to ensure that the write succeeds.
Consider the following prototype form.
{ getLastError: 1 }
The following options are available:
Parameters:
j (boolean) – If true, wait for the next journal commit before returning, rather than a full disk flush. If mongod does not have journaling enabled, this option has no effect.
w – When running with replication, this is the number of servers to replicate to before returning. A w value of 1 indicates the primary only. A w value of 2 includes the primary and at least one secondary, etc. In place of a number, you may also set w to majority to indicate that the command should wait until the latest write propagates to a majority of replica set members. If using w, you should also use wtimeout. Specifying a value for w without also providing a wtimeout may cause getLastError to block indefinitely.
fsync (boolean) – If true, wait for mongod to write this data to disk before returning. Defaults to false. In most cases, use the j option to ensure durability and consistency of the data set.
wtimeout (integer) – Optional. Milliseconds. Specify a value in milliseconds to control how long to wait for write propagation to complete. If replication does not complete in the given timeframe, the getLastError command will return with an error status.
See also Write Concern, Replica Set Write Concern, and db.getLastError().
getLastError¶
The getLastError command returns the error status of the last operation on the current connection. By default MongoDB does not provide a response to confirm the success or failure of a write operation, clients typically use getLastError in combination with write operations to ensure that the write succeeds.
Consider the following prototype form.
{ getLastError: 1 }
The following options are available:
Parameters:
j (boolean) – If true, wait for the next journal commit before returning, rather than a full disk flush. If mongod does not have journaling enabled, this option has no effect.
w – When running with replication, this is the number of servers to replicate to before returning. A w value of 1 indicates the primary only. A w value of 2 includes the primary and at least one secondary, etc. In place of a number, you may also set w to majority to indicate that the command should wait until the latest write propagates to a majority of replica set members. If using w, you should also use wtimeout. Specifying a value for w without also providing a wtimeout may cause getLastError to block indefinitely.
fsync (boolean) – If true, wait for mongod to write this data to disk before returning. Defaults to false. In most cases, use the j option to ensure durability and consistency of the data set.
wtimeout (integer) – Optional. Milliseconds. Specify a value in milliseconds to control how long to wait for write propagation to complete. If replication does not complete in the given timeframe, the getLastError command will return with an error status.
See also Write Concern, Replica Set Write Concern, and db.getLastError().
发表评论
-
mongodb 从3.0 升级到3.2
2016-06-15 19:27 1404下载mongodb: curl "https://f ... -
MongoDB 日志切换
2016-06-13 17:47 775MongoDB默认情况下不会自动的切换轮转日志的,这将会导致日 ... -
mongodb c++ driver 从2.4.6 升级到3.0.1 注意点 (windows版本)
2015-09-15 17:58 6311. 使用mongodbclient的静态库需要定义下面的值 ... -
check_mongodb nagios
2015-08-17 17:22 0nagios check_mongodb插件监控mongodb ... -
Mongodb profiling
2015-08-06 10:14 361Mongodb profiling是Mngodb提供的类似于m ... -
linux mongdb 备份操作笔记
2015-07-22 09:21 529目的:添加一个延迟1小时的sencodary作为冷备数据库 ... -
mongodb 操作失失误救策略
2015-07-14 20:47 381杀掉某个正在处理的操作: db.currentOp() db ... -
mongodb oplog
2015-06-30 10:53 473mongodb oplog的使用 所在位置: Master/ ... -
mongodb 升级的问题导致添加帐号出现问题
2015-06-05 11:47 894mongodb 原有数据库版本:2.2.2 更新到数据库版本 ... -
libmongodbclient 2.6.6
2015-02-25 11:43 438mongodb c++ driver 2.6之后的版本不能从m ... -
mongodb 搜索结果保存到文件中
2013-07-22 16:44 1895第一种方式: mongo localhost:11111/te ... -
getLastError mongodb
2013-04-03 10:32 0一、简介 很多人抱怨mongodb是内存数据库,也没有事务,会 ... -
[转]十个 MongoDB 使用要点
2013-03-20 10:19 781从 [url = "http://space.i ... -
利用mongodb c++ driver来编译
2012-12-04 15:12 0编译库时错误: 引用 E:\code_64\v2.2.2\m ... -
scons 64 mongodb
2012-08-01 19:52 943编译64位mongodb spin_lock.cpp cl ... -
scons 编译 mongodb client lib
2012-07-31 20:09 1173Use scons to build MongoDB and ... -
MongoDB 客户端 MongoVue
2012-05-14 11:13 913今天在同事那里看到了 ... -
mongodb 2.0.0 replica set + authentication bug
2012-04-26 13:56 894mongodb 2.0.0 replica set + aut ... -
array in mongodb ( c++ driver)
2012-04-25 17:31 2166BSONArray BSONArrayBuilder ... -
(转) RockMongo查询操作用法总结
2012-04-11 20:40 27331.简单查询 //xid=560870 and type=vi ...
相关推荐
通过调用GetLastError函数,返回值的意义
GetLastError 与 FormatMessage 连用,显示GetLastError返回值的各种含义;
GetLastError()返回值从0到3259,了解错误原因,以便调试程序
mfc中getlasterror所有返回值的含义,其实看头文件也能看得到
GetLastError返回值的含义2
提供一个模板函数,返回 GetLastError()错误码所对应的信息。方便查找错误原因。如果需要修改,也很方便。
GetLastError()返回值的含义
解析windows 系统错误码的含义 GetLastError SysErrorMessage 系统错误
WINDOWDS核心编程笔记的源码
GetLastError()的所有返回值 的错误类型(汉语解释),非常有助于网络编程
GetLastError返回值,详细描述GetLastError返回值的意义
收集的GetLastError的错误总结,方便各位离线查询
GetLastError()的值.doc
数据库命令-GETLASTERROR 数据库命令-ISMASTER 数据库命令-LISTCOMMANDS 数据库命令-LISTDATABASES 数据库命令-PING 数据库命令-RENAMECOLLECTION 数据库命令-REPAREDATABASE 数据库命令-SERVERSTATUS 定容集合 定容...
GetLastError()错误返回码代表的意思大全
调用VC++函数出错后,我们通常会调用GetLastError函数来获取错误代码,而错误代码是以数字的形式输出的。这里提供一个能解析错误代码的程序,以方便大家编程调试。
windows 网络编程中常用函数GetLastError()返回错误代码大全,所有返回错误代码都包括在内,从0-11031,绝对值得下载收藏