可以使用非法名称复制沙发数据库
Possible to replicate couch database with illegal name
我正在使用此命令复制 100mb 数据库
curl -H 'Content-Type: application/json' \
-X POST http://localhost:5984/_replicate \
-d '{"source": "http://example.com:5984/bad_name_with_underscore", "target": "good_name"}'
我无法复制,因为 CouchDB 说源数据库名称包含非法字符。 我能理解 CouchDB 的人不鼓励用户创建错误的数据库名称,但从中读取并没有坏处。
我不是源 CouchDB 的管理员,所以我尝试将数据库导出为 JSON,然后批量放入新数据库。但是我遇到了{"error":"bad_request","reason":"Missing JSON list of 'docs'"}
。尽管我试图通过将结构更改为 {"docs": [...]}
.
来修改 dump.json
我想知道,有没有其他方法可以复制名称中带有下划线的数据库?
我已经使用客户端 PouchDB 解决了这个问题。这是代码。
const PouchDB = require('pouchdb')
const source = new PouchDB("http://example.com:5984/bad_name_with_underscore")
source.replicate.to("http://localhost:5984/good_name")
.on('complete', console.log)
.on('error', console.error)
效果很好,所以我post分享给大家。
我正在使用此命令复制 100mb 数据库
curl -H 'Content-Type: application/json' \
-X POST http://localhost:5984/_replicate \
-d '{"source": "http://example.com:5984/bad_name_with_underscore", "target": "good_name"}'
我无法复制,因为 CouchDB 说源数据库名称包含非法字符。 我能理解 CouchDB 的人不鼓励用户创建错误的数据库名称,但从中读取并没有坏处。
我不是源 CouchDB 的管理员,所以我尝试将数据库导出为 JSON,然后批量放入新数据库。但是我遇到了{"error":"bad_request","reason":"Missing JSON list of 'docs'"}
。尽管我试图通过将结构更改为 {"docs": [...]}
.
我想知道,有没有其他方法可以复制名称中带有下划线的数据库?
我已经使用客户端 PouchDB 解决了这个问题。这是代码。
const PouchDB = require('pouchdb')
const source = new PouchDB("http://example.com:5984/bad_name_with_underscore")
source.replicate.to("http://localhost:5984/good_name")
.on('complete', console.log)
.on('error', console.error)
效果很好,所以我post分享给大家。