diff options
author | Randolph Tan <randolph@10gen.com> | 2015-04-20 15:36:09 -0400 |
---|---|---|
committer | Randolph Tan <randolph@10gen.com> | 2015-05-11 10:09:05 -0400 |
commit | 9f0ceef0b37df2525cdebb172e6b05e2db8a2b20 (patch) | |
tree | 11fa779defcac750089916964aeee605d3330a17 /jstests/core/read_after_optime.js | |
parent | b73ab5765fb75ae87ee5ad0f4afbc4fdfc2bc151 (diff) | |
download | mongo-9f0ceef0b37df2525cdebb172e6b05e2db8a2b20.tar.gz |
SERVER-18195 Read after optime (repl only)
Diffstat (limited to 'jstests/core/read_after_optime.js')
-rw-r--r-- | jstests/core/read_after_optime.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/jstests/core/read_after_optime.js b/jstests/core/read_after_optime.js new file mode 100644 index 00000000000..d185b660887 --- /dev/null +++ b/jstests/core/read_after_optime.js @@ -0,0 +1,22 @@ +// Test that attempting to read after optime fails if replication is not enabled. + +(function() { +"use strict"; + +var currentTime = new Date(); + +var futureOpTime = new Timestamp((currentTime / 1000 + 3600), 0); + +var res = assert.commandFailed(db.runCommand({ + find: 'user', + filter: { x: 1 }, + after: { + opTime: { ts: futureOpTime, term: 0 } + } +})); + +assert.eq(123, res.code); // ErrorCodes::NotAReplicaSet +assert.eq(null, res.waitedMS); + +})(); + |