summaryrefslogtreecommitdiff
path: root/jstests
diff options
context:
space:
mode:
Diffstat (limited to 'jstests')
-rw-r--r--jstests/sharding/copydb_from_mongos.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/jstests/sharding/copydb_from_mongos.js b/jstests/sharding/copydb_from_mongos.js
new file mode 100644
index 00000000000..c0aac23d552
--- /dev/null
+++ b/jstests/sharding/copydb_from_mongos.js
@@ -0,0 +1,16 @@
+var st = new ShardingTest({ shards: 2, other: { shardOptions: { verbose: 1 }}});
+
+var testDB = st.s.getDB('test');
+assert.writeOK(testDB.foo.insert({ a: 1 }));
+
+var res = testDB.adminCommand({ copydb: 1,
+ fromhost: st.s.host,
+ fromdb: 'test',
+ todb: 'test_copy' });
+assert.commandWorked(res);
+
+var copy = st.s.getDB('test_copy');
+assert.eq(1, copy.foo.count());
+assert.eq(1, copy.foo.findOne().a);
+
+st.stop();