- 浏览: 268483 次
- 性别:
- 来自: 上海
文章分类
- 全部博客 (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 1425下载mongodb: curl "https://f ... -
MongoDB 日志切换
2016-06-13 17:47 820MongoDB默认情况下不会自动的切换轮转日志的,这将会导致日 ... -
mongodb c++ driver 从2.4.6 升级到3.0.1 注意点 (windows版本)
2015-09-15 17:58 6861. 使用mongodbclient的静态库需要定义下面的值 ... -
check_mongodb nagios
2015-08-17 17:22 0nagios check_mongodb插件监控mongodb ... -
Mongodb profiling
2015-08-06 10:14 406Mongodb profiling是Mngodb提供的类似于m ... -
linux mongdb 备份操作笔记
2015-07-22 09:21 586目的:添加一个延迟1小时的sencodary作为冷备数据库 ... -
mongodb 操作失失误救策略
2015-07-14 20:47 431杀掉某个正在处理的操作: db.currentOp() db ... -
mongodb oplog
2015-06-30 10:53 517mongodb oplog的使用 所在位置: Master/ ... -
mongodb 升级的问题导致添加帐号出现问题
2015-06-05 11:47 938mongodb 原有数据库版本:2.2.2 更新到数据库版本 ... -
libmongodbclient 2.6.6
2015-02-25 11:43 487mongodb c++ driver 2.6之后的版本不能从m ... -
mongodb 搜索结果保存到文件中
2013-07-22 16:44 1932第一种方式: mongo localhost:11111/te ... -
getLastError mongodb
2013-04-03 10:32 0一、简介 很多人抱怨mongodb是内存数据库,也没有事务,会 ... -
[转]十个 MongoDB 使用要点
2013-03-20 10:19 828从 [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 973编译64位mongodb spin_lock.cpp cl ... -
scons 编译 mongodb client lib
2012-07-31 20:09 1213Use scons to build MongoDB and ... -
MongoDB 客户端 MongoVue
2012-05-14 11:13 944今天在同事那里看到了 ... -
mongodb 2.0.0 replica set + authentication bug
2012-04-26 13:56 921mongodb 2.0.0 replica set + aut ... -
array in mongodb ( c++ driver)
2012-04-25 17:31 2224BSONArray BSONArrayBuilder ... -
(转) RockMongo查询操作用法总结
2012-04-11 20:40 27821.简单查询 //xid=560870 and type=vi ...
相关推荐
`db.getLastError()`函数提供了检测写操作是否成功的方法,并且可以通过设置超时来避免无限期等待的情况发生。 最后,数据库管理员在面对数据损坏或迁移问题时,需要对集合的有效性进行检验。如果数据在迁移或备份...
8. **错误与日志**:`db.getLastError()`和`db.getLastErrorObj()`用于检查最近一次操作的错误信息,`db.getProfilingLevel()`设置或查看性能剖析级别,`db.printCollectionStats()`打印集合的统计信息,`db....
- `db.getLastError()`:获取最后一个错误消息 - `db.getLastErrorObj()`:获取最后一个错误对象 - `db.getMongo().setSlaveOk()`:设置从服务器查询 以上就是根据给定的文档内容提取和整理出的关键知识点。这些...
但 MongoDB 提供了可以确认当前写操作是否成功提交的 getLastError 方法。 安全 MongoDB 支持基于角色的访问控制(RBAC),可以对用户和角色进行授权和认证。 MongoDB 还支持 SSL/TLS 加密和 Kerberos 认证。 ...
- `db.getLastError()` 和 `db.getLastErrorObj()`:检查最近一次操作的错误信息。 - `db.getMongo()`:获取当前服务器连接对象。 - `db.removeUser(username)`:从数据库中删除用户。 - `db.repairDatabase()`:...
11. **`getLastError`**:获取上次操作的状态,对于调试和错误处理很有帮助。 12. **`group`**:执行分组聚合,允许根据指定字段对数据进行汇总,是数据分析师的常用工具。 13. **`isMaster`**:检查服务器是否为...
MongoDB的连接字符串是连接MongoDB数据库的关键组成部分,它包含了所有必要的信息,如服务器地址、认证信息、数据库名称以及各种连接参数。以下是对MongoDB连接字符串的详细解释: 首先,连接字符串的基本格式如下...
1、我怎么查看 Mongo 正在使用的链接 2、数据库的整体结构 4、getLastError的作用 5、启用备份故障恢复需要多久 6、mongodb是否支持事