Giter VIP home page Giter VIP logo

pouchdb's Introduction

PouchDB โ€“ The Database that Syncs!

Build Status Coverage Status Greenkeeper badge npm version jsDelivr Hits

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 and API documentation.

Getting Help

The PouchDB community is active in #pouchdb on the CouchDB Slack, in the Google Groups mailing list, and on StackOverflow. Or you can mastodon @pouchdb!

If you think you've found a bug in PouchDB, please write a reproducible test case and 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 hand 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, and other (slightly!) nitpicky things like that. PouchDB is heavily tested, so you'll also want to check out the testing guide.

pouchdb's People

Contributors

albaherrerias avatar alxndrsn avatar benrudolph avatar calvinmetcalf avatar chesles avatar crodjer avatar daleharvey avatar espy avatar garethbowen avatar garrensmith avatar greenkeeper[bot] avatar greenkeeperio-bot avatar howonlee avatar jankaszel avatar janl avatar jcoglan avatar jo avatar marten-de-vries avatar mikeal avatar neojski avatar nick-thompson avatar nickcolley avatar nolanlawson avatar ryanramage avatar snyk-bot avatar sourcer85 avatar tilgovi avatar willholley avatar yaronyg avatar ymichael avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pouchdb's Issues

Uncaught TypeError: Cannot read property '0' of undefined

var docs = [{"id":0,"x":1,"y":2,"z":3,"country":"DE","label":"first","lat":52.56,"lon":13.4},{"id":1,"x":2,"y":4,"z":6,"country":"UK","label":"second","lat":54.97,"lon":-1.6},{"id":2,"x":3,"y":6,"z":9,"country":"US","label":"third","lat":40,"lon":-75.5},{"id":3,"x":4,"y":8,"z":12,"country":"UK","label":"fourth","lat":57.27,"lon":-6.2},{"id":4,"x":5,"y":10,"z":15,"country":"UK","label":"fifth","lat":51.58,"lon":0},{"id":5,"x":6,"y":12,"z":18,"country":"DE","label":"sixth","lat":51.04,"lon":7.9}]

var p

new Pouch("idb://test", function(err, db) {
  p = db
})

function save(callback) {
  p.bulkDocs({docs: docs}, callback || function() {})
}

setInterval(save, 1000)

Cant implement db.exists

IndexedDB doesnt doesnt allow for this api, this means replications will always create their target etc

Strange error when callback is omitted

I get this strange error message when there's no callback provided for the pouch.open function:

TypeError: Cannot read property 'http' of undefined

I know that calling this function without callback doesn't make sense, but the error message should indicate that this is the problem.

Deleting a database blocks permanently

The current failing tests are due to deleteDatabase receiving an onblocked event and not completing, I dont know what is causing the onblocked event as there should be no open databases at the point it runs, and there isnt much documentation on how to unblock it

_all_dbs is unimplementable

There is no API to list the currently defined IndexedDB's

This is just an issue to keep track of when browsers implement it, I am fairly sure they will have to at some point

futon

Hi Guys,

I Start a portable version of futon to pouchdb. 
how think is a good idea?

cheers

Opening a db with a leading underscore fails silently

No error is returned and you get a db object in the callback but when you try to write to it you get a "NOT_FOUND_ERR: DOM IDBDatabase Exception 3" - we should return a sensible error about valid database names

Continuous Replication

At one point, I believe that you could pass {continuous: true} as an options object to db.replicate.to and db.replicate.from. Currently it looks like the methods still take an opts argument, but now it is not used.

Are there plans to deprecate this functionality, or does it need to be reimplemented? Continuous replication seems to be a preferable approach to using a setInterval to regularly run replication.

PouchDB API Design

Currently most PouchDB api calls are of the format

pouch.function(arg, [options], [callback])

This makes for a nice api however, I prefer a plain success callback than attaching one to options, however it does mean that pretty much every function needs to start with

if (opts instanceof Function) {
  callback = opts;
  opts = {};
}

We can provide a fixargs wrapper, so

pouch.get = fixArgs(function(doc, opts, callback ...

but that seems pretty ugly as well, any ideas?

Another issue is how we provide error callbacks, we currently use the node.js idiom of

pouch.get('id', function(err, doc) { 
} 

Which is nice enough, I am happy sticking with it, especially when there are people looking to implement a pouchdb server in node, but open for suggestions

The last issue is out of band data, I have been attaching things like status codes to the returned data however that isnt going to work in a lot of situations, so this will probably be changed to have an extra compatibility object in the callback such that:

pouch.get('id', function(err, doc, meta) {
  console.log(meta.status);
  console.log(meta.header('Content-Type')); 
}

We will also be moving towards a object model closer to Lawnchair of

new Pouch('name', fun....

which lets us have instance options for individual instances and handles the adapter model better, we will also use protocol based names so you can

Pouch.replicate('idb://test', 'http://127.0.0.1/test', ...

Code is broken (still/again?)

The mergeTrees code added by tilgovi has a number if syntax errors that completely break pouchdb causing it to fail all unit tests. I have commented mergeTrees out and now tests 1 and 2 pass, but it hangs on test 3 I think. txn.objectStore('ids').openCursor() could be the culprit. I don't know enough about IndexDB, nor the PouchDB code to be sure.

Can someone give me an idea of the status of the PouchDB project.

I think it would be brilliant to have CouchDB capabilities running in the browser (JS) with IndexedDB and Couch's Replication. I've yet to find any solution for sometimes connected apps with replication anywhere near as good as CouchDB. Nothing I'm aware of comes close.

Congrats to the folks working on PouchDB. I really would love to see this completed.

Neville

unit testing and minify/compile flow

So I finally took a pass at writing a function to merge rev trees. I can push it to a branch for testing, but I want to unit test it outside the browser for reals.

I propose to break out the library stuff at the top of pouch.js into separate files. We should be able to compile the aggregate out to one file, optionally minified for production.

Eventually we will want this if we move forward with the LevelDB implementation so we can share code.

I was playing with browserify this week, but I don't know if it can export the result or just serve it from a running node process, but I'd love to use the require() module style.

Automate testing all combinations of adapters

Each test that has 2 database that interact with each other should automatically tun against each combination of the adapters

idb <-> http, idb <-> idb, http <-> idb, http <-> http

etc

This is the easiest way to test the completeness of each adapter without massively redundant tests

removeCouch doesnt actually do anything

on chrome 13.0.782.107

there isnt a test to test it either

you can see this fail by running test.html a few times and watching the number of docs go up by 100 each time you reload

Chominium show some warnings/errors

hi guys

i'm trying using chrominium for use the dev tool to inspect indexeddb but nothing :(
insted that show some warnings and an error

Numeric transaction modes are deprecated in IDBDatabase.transaction. Use "readonly" or "readwrite".
Numeric direction values are deprecated in IDBObjectStore.openCursor. Use"next", "nextunique", "prev", or "prevunique".
Uncaught Error: NOT_ALLOWED_ERR: DOM IDBDatabase Exception 6 pouch.idb.js:394

what i do wrong?

Dont report errors via bulk docs correctly

I have been using

{error: 'error', reason: 'reason', status: 400}

to report errors, I find it handy to copy the http status codes, need to ensure bulkdocs report these for things like invalid revisions

bug when make the branch master

Hi guys,

When i try make the master branch, and include the pouch.alpha.js on my html file i had an error on chrome:

Uncaught TypeError: Cannot set property 'merge' of undefined
resultspouch.alpha.js:602
(anonymous function)pouch.alpha.js:613
(anonymous function)pouch.alpha.js:1806

some one knows why this?

Cross-domain CouchDB access with iframe trick

It would be possible to implement cross-domain CouchDB access by using a simple iframe trick.

The first step would be placing a proxy.html on the target CouchDB as a document. On the client website, a PouchDB instance would create a hidden iframe with this proxy.html in it.

proxy.html can make XMLHttpRequests to the target CouchDB instance (since it is on the same domain), and PouchDB can communicate with proxy.html using the postMessage function. The message format could be JSON-RPC.

From the user's perspective would look like new Pouch('iframe://couch.com/db/proxy', function() {}).

I know that this is a hacky workaround, but the CORS ticket on CouchDB's bug tracker is 3 years old now, and I don't expect it to be resolved soon.

Firefox Support

I think it may be a bug related to objectstores without a keypath that autoIncrement

Have a proxy for controlling a remote couch

I would like to mirror the api for communicating with a remote couchdb server with the same api

pouch.open('http://mycouch.com/test', function ....

This allows a fallback for when idb support isnt around, without having to change any user code

Not planning to implement it until the idb version is somewhat complete, but just making a note

settle on a decent javascript abstract couch interface

In order to avoid writing a replicator (and any other higher level modules) twice there should be some API exposed which is common between both the browser and the node environment.

I propose the following hybrid of DOM Events and Node.JS style APIs:

  • The last argument is always either an Events-style options Object or callback Function.
  • If there are no options passed the argument may be left out and replaced with a callback Function.
  • If both an options Object and a callback Function are specified (in that order), the callback should supersede any event handlers in the options and the callback should be called according to Node.JS idioms.
  • All events and callbacks receive JavaScript objects which are the native equivalent of the JSON for the matching Apache CouchDB request.

I think this can make everyone happy. It's trivial to write a function that consumes options and a callback and turns the possible combinations into a single options argument (properly wrapping the callback in event handlers) so that external code can write to either API and internal code can do what makes sense for the environment.

Stop using random database names in tests

if tests crash, leaves us no way to clean up the database, firefox has some fairly small limit to the number of databases to a host, I havent hit chromes limit yet

Code is broken

I am trying to use it, and i get a lot of "not implemented" and "implement X
ASAP" messages and it only managed to create records, tests also fail.

is there any prevision for pouchDB to be usable?

by the way great idea!.

Intermittent test failures

Happening occasionally in chrome

test.bulk_docs.js:28 Uncaught TypeError: Cannot read property 'length' of undefined

LocalStorage Adapter

We could do with lots of adapters, but localstorage is probably the most important

Getting Attachments With a Document

"If you need to fetch a document and all its attachments in one request, add an ?attachments=true URL parameter to the GET request. The resulting JSON will include the base64-encoded contents in the "data" property of each attachment, just as in an inline upload." [http://wiki.apache.org/couchdb/HTTP_Document_API#Getting_Attachments_With_a_Document]

Support for that inline attachments api would be great.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.