pouchdb/pouchdb: - PouchDB is a pocket-sized database. (github.com)
这是一个用JavaScript编写的,运行在浏览器中的NoSQL数据库
一个很新颖的设计
它能够在离线状态下将数据存储至本地,并在网络恢复后自动同步数据,保持数据与服务器同步。
示例代码:
var db = new PouchDB(‘dbname’);
db.put({
_id: ‘hellogithub-1’,
name: ‘HelloGitHub’,
age: 69
});db.changes().on(‘change’, function() {
console.log(‘Ch-Ch-Changes’);
});db.replicate.to(‘远程数据库地址’);
——————
项目READEME(建议搭配沉浸式翻译)
PouchDB – The Database that Syncs!
PouchDB is an open-source JavaScript database inspired by Apache CouchDB that is designed to run well within the browser.
PouchDB was created to help web developers build applications that work as well offline as they do online.
Using PouchDB
To get started using PouchDB, check out the web site 和 API documentation。
Getting Help
The PouchDB community is active in #pouchdb
on the CouchDB Slack, in the Google Groups mailing list,和 on StackOverflow. Or you can mastodon @pouchdb!
If you think you’ve found a bug in PouchDB, please write a reproducible test case 和 file a Github issue。
Prerelease builds
If you like to live on the bleeding edge, you can build PouchDB from source using these steps:
git clone https://github.com/pouchdb/pouchdb.git
cd pouchdb
npm install
After running these steps, the browser build can be found in packages/node_modules/pouchdb/dist/pouchdb.js
。
Changelog
PouchDB follows semantic versioning. To see a changelog with all PouchDB releases, check out the Github releases page。
For a concise list of breaking changes, there’s the wiki list of breaking changes。
Keep in mind that PouchDB is auto-migrating, so a database created in 1.0.0 will still work if you open it in 4.0.0+. Any release containing a migration is clearly marked in the release notes.
Contributing
We’re always looking for new contributors! If you’d like to try your h和 at writing code, writing documentation, designing the website, writing a blog post, or answering questions on StackOverflow, then we’d love to have your input.
If you have a pull request that you’d like to submit, please read the contributing guide for info on style, commit message format, 和 other (slightly!) nitpicky things like that. PouchDB is heavily tested, so you’ll also want to check out the testing guide。