Skip to content

Commit

Permalink
docs: update hardcoded links to use site.baseurl
Browse files Browse the repository at this point in the history
  • Loading branch information
alxndrsn committed Aug 14, 2023
1 parent 307dea3 commit 0d77397
Show file tree
Hide file tree
Showing 32 changed files with 46 additions and 46 deletions.
2 changes: 1 addition & 1 deletion docs/_guides/async-code.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ If you already understand promises, you can [skip to the next section](updating-
{% markdown %}

**What about async/await?** Async functions are an experimental ES7 syntax that enhances promise-based APIs by adding
the `async` and `await` keywords. For more information about `async`/`await`, read [our introductory blog post](http://pouchdb.com/2015/03/05/taming-the-async-beast-with-es7.html).
the `async` and `await` keywords. For more information about `async`/`await`, read [our introductory blog post]({{ site.baseurl }}/2015/03/05/taming-the-async-beast-with-es7.html).

{% endmarkdown %}
{% include alert/end.html%}
Expand Down
2 changes: 1 addition & 1 deletion docs/_guides/bulk-operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ You can see **[a live example](http://bl.ocks.org/nolanlawson/8f58dbc360348a4c95

Far too many developers overlook this valuable API, because they misunderstand it. When a developer says "my PouchDB app is slow!", it is usually because they are using the slow `query()` API when they should be using the fast `allDocs()` API.

For details on how to effectively use `allDocs()`, you are strongly recommended to read ["Pagination strategies with PouchDB"](http://pouchdb.com/2014/04/14/pagination-strategies-with-pouchdb.html). For 99% of your applications, you should be able to use `allDocs()` for all the pagination/sorting/searching functionality that you need.
For details on how to effectively use `allDocs()`, you are strongly recommended to read ["Pagination strategies with PouchDB"]({{ site.baseurl }}/2014/04/14/pagination-strategies-with-pouchdb.html). For 99% of your applications, you should be able to use `allDocs()` for all the pagination/sorting/searching functionality that you need.

{% include anchor.html title="Related API documentation" hash="related-api-documentation" %}

Expand Down
2 changes: 1 addition & 1 deletion docs/_guides/mango-queries.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ db.find({
});
```

In this case, we only get 10 documents back, but they are the first 10 documents, sorted by name. This means that we have only read 10 documents out of the database into memory, which can be used for [efficient pagination](http://pouchdb.com/2014/04/14/pagination-strategies-with-pouchdb.html).
In this case, we only get 10 documents back, but they are the first 10 documents, sorted by name. This means that we have only read 10 documents out of the database into memory, which can be used for [efficient pagination]({{ site.baseurl }}/2014/04/14/pagination-strategies-with-pouchdb.html).

For instance, if we are displaying the first 10 results on a single page, and the user clicks "next" to see the next page, we can restructure our query based on the last result, to continue the pagination. Let's imagine the first 10 documents' `name`s are:

Expand Down
2 changes: 1 addition & 1 deletion docs/_guides/queries.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ pouch.query(myMapReduceFun, {
});
```

If you're adventurous, though, you should check out the [CouchDB documentation](http://couchdb.readthedocs.org/en/latest/couchapp/views/intro.html) or the [PouchDB documentation](http://pouchdb.com/api.html#query_database) for details on reduce functions.
If you're adventurous, though, you should check out the [CouchDB documentation](http://couchdb.readthedocs.org/en/latest/couchapp/views/intro.html) or the [PouchDB documentation]({{ site.baseurl }}/api.html#query_database) for details on reduce functions.

{% include anchor.html title="Avoiding map/reduce" hash="avoiding-map-reduce" %}

Expand Down
2 changes: 1 addition & 1 deletion docs/_guides/replication.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ Any PouchDB object can replicate to any other PouchDB object. So for instance, y

This can be very powerful, because it enables lots of fancy scenarios. For example:

1. You have an [in-memory PouchDB](http://pouchdb.com/adapters.html#pouchdb_in_the_browser) that replicates with a local PouchDB, acting as a cache.
1. You have an [in-memory PouchDB]({{ site.baseurl }}/adapters.html#pouchdb_in_the_browser) that replicates with a local PouchDB, acting as a cache.
2. You have many remote CouchDB databases that the user may access, and they are all replicated to the same local PouchDB.
3. You have many local PouchDB databases, which are mirrored to a single remote CouchDB as a backup store.

Expand Down
2 changes: 1 addition & 1 deletion docs/_includes/api/create_document.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

If you want to update an existing document even if there's conflict, you should specify the base revision `_rev` and use `force=true` option, then a new conflict revision will be created.

`doc` must be a "pure JSON object", i.e. a collection of name/value pairs. If you try to store non-JSON data (for instance `Date` objects) you may see [inconsistent results](http://pouchdb.com/errors.html#could_not_be_cloned).
`doc` must be a "pure JSON object", i.e. a collection of name/value pairs. If you try to store non-JSON data (for instance `Date` objects) you may see [inconsistent results]({{ site.baseurl }}/errors.html#could_not_be_cloned).

#### Example Usage:

Expand Down
2 changes: 1 addition & 1 deletion docs/_includes/api/delete_document.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

Deletes the document. `doc` is required to be a document with at least an `_id` and a `_rev` property. Sending the full document will work as well.

See [filtered replication](http://pouchdb.com/api.html#filtered-replication) for why you might want to use `put()` with `{_deleted: true}` instead.
See [filtered replication]({{ site.baseurl }}/api.html#filtered-replication) for why you might want to use `put()` with `{_deleted: true}` instead.

#### Example Usage:

Expand Down
2 changes: 1 addition & 1 deletion docs/_includes/api/overview.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
}
{% endhighlight %}

Any `await` not inside of an async function is a syntax error. For more information about `async`/`await`, read [our introductory blog post](http://pouchdb.com/2015/03/05/taming-the-async-beast-with-es7.html).
Any `await` not inside of an async function is a syntax error. For more information about `async`/`await`, read [our introductory blog post]({{ site.baseurl }}/2015/03/05/taming-the-async-beast-with-es7.html).

[promise]: https://www.promisejs.org/
[lie]: https://github.com/calvinmetcalf/lie
Expand Down
2 changes: 1 addition & 1 deletion docs/_includes/api/save_attachment.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

This method will update an existing document to add the attachment, so it requires a `rev` if the document already exists. If the document doesn't already exist, then this method will create an empty document containing the attachment.

What's the point of attachments? If you're dealing with large binary data (such as PNGs), you may incur a performance or storage penalty if you naïvely include them as base64- or hex-encoded strings inside your documents. But if you insert the binary data as an attachment, then PouchDB will attempt to store it in [the most efficient way possible](http://pouchdb.com/faq.html#data_types).
What's the point of attachments? If you're dealing with large binary data (such as PNGs), you may incur a performance or storage penalty if you naïvely include them as base64- or hex-encoded strings inside your documents. But if you insert the binary data as an attachment, then PouchDB will attempt to store it in [the most efficient way possible]({{ site.baseurl }}/faq.html#data_types).

For details, see the [CouchDB documentation on attachments](https://docs.couchdb.org/en/stable/api/document/attachments.html#put--db-docid-attname).

Expand Down
6 changes: 3 additions & 3 deletions docs/_posts/2014-04-14-pagination-strategies-with-pouchdb.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pouch.bulkDocs({docs : docs}, function (err, response) {
});
```

Now, the simplest kind of Pouch query, called [`allDocs()`](http://pouchdb.com/api.html#batch_fetch), doesn't do any pagination by default. As the name implies, it just returns all the docs:
Now, the simplest kind of Pouch query, called [`allDocs()`]({{ site.baseurl }}/api.html#batch_fetch), doesn't do any pagination by default. As the name implies, it just returns all the docs:

```javascript
pouch.allDocs(function (err, response) {
Expand Down Expand Up @@ -421,6 +421,6 @@ So congratulations, you're now a [Page Master]! Try to use your newfound powers
[couch-query-api]: https://wiki.apache.org/couchdb/HTTP_view_API#Querying_Options
[js-string-ordering]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String#Comparing_strings
[collation-specification]: http://docs.couchdb.org/en/latest/couchapp/views/collation.html#collation-specification
[query-api]: http://pouchdb.com/api.html#query_database
[query-api]: {{ site.baseurl }}/api.html#query_database
[page master]: https://en.wikipedia.org/wiki/Pagemaster
[remove]: http://pouchdb.com/api.html#delete_document
[remove]: {{ site.baseurl }}/api.html#delete_document
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ pouch.query(myMapFunction, {

{% include alert/start.html variant="info"%}

The pagination options for <code>query()</code> &ndash; i.e., <code>startkey</code>/<code>endkey</code>/<code>key</code>/<code>keys</code>/<code>skip</code>/<code>limit</code>/<code>descending</code> &ndash; are exactly the same as with <code>allDocs()</code>. For a beginner's guide to pagination, read <a href='http://pouchdb.com/2014/04/14/pagination-strategies-with-pouchdb.html'>Pagination strategies with PouchDB</a>.
The pagination options for <code>query()</code> &ndash; i.e., <code>startkey</code>/<code>endkey</code>/<code>key</code>/<code>keys</code>/<code>skip</code>/<code>limit</code>/<code>descending</code> &ndash; are exactly the same as with <code>allDocs()</code>. For a beginner's guide to pagination, read <a href='{{ site.baseurl }}/2014/04/14/pagination-strategies-with-pouchdb.html'>Pagination strategies with PouchDB</a>.

{% include alert/end.html %}

Expand All @@ -157,7 +157,7 @@ pouch.query(myMapReduceFun, {
});
```

If you're adventurous, though, you should check out the [CouchDB documentation](http://couchdb.readthedocs.org/en/latest/couchapp/views/intro.html) or the [PouchDB documentation](http://pouchdb.com/api.html#query_database) for details on reduce functions.
If you're adventurous, though, you should check out the [CouchDB documentation](http://couchdb.readthedocs.org/en/latest/couchapp/views/intro.html) or the [PouchDB documentation]({{ site.baseurl }}/api.html#query_database) for details on reduce functions.

Map/reduce, reuse, recycle
----------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,15 @@ You are taking this thing which is meant to sort and organize data, and you're g

### 5. Use plugins

[PouchDB has plugins](http://pouchdb.com/external.html). Use them, and if inspiration ever strikes, [write your own](https://github.com/pouchdb/plugin-seed)!
[PouchDB has plugins]({{ site.baseurl }}/external.html). Use them, and if inspiration ever strikes, [write your own](https://github.com/pouchdb/plugin-seed)!

### 6. Don't just update docs for the hell of it

Every time you modify a document, another revision is added to its revision history &ndash; think Git. Except unlike Git, these revisions contain the full document data (not just the diffs), which can take up a lot of space on disk. So if nothing changed in a document, don't bother `put()`ing it again.

### 7. Use and abuse your doc IDs

I already wrote [a blog post about this](http://pouchdb.com/2014/05/01/secondary-indexes-have-landed-in-pouchdb.html), but basically, if you don't want bad performance from your secondary indexes, the best strategy is to avoid secondary indexes altogether. The primary index should be sufficient for sorting and searching in nearly all of your applications, or at least for the hot-path code.
I already wrote [a blog post about this]({{ site.baseurl }}/2014/05/01/secondary-indexes-have-landed-in-pouchdb.html), but basically, if you don't want bad performance from your secondary indexes, the best strategy is to avoid secondary indexes altogether. The primary index should be sufficient for sorting and searching in nearly all of your applications, or at least for the hot-path code.

Also, if you really want to get fancy with your doc IDs, you can use [PouchDB Collate](https://github.com/pouchdb/collate/) to serialize arbitrary data into strings that are sorted according to [CouchDB collation ordering](https://docs.couchdb.org/en/latest/ddocs/views/collation.html). This allows you to index on arrays, objects, numbers &ndash; whatever you want:

Expand Down Expand Up @@ -178,7 +178,7 @@ if (!pouch.adapter) { // websql not supported by this browser

### 9. Move logic from the map function to query()

If you only remember one thing from [my blog post about secondary indexes](http://pouchdb.com/2014/05/01/secondary-indexes-have-landed-in-pouchdb.html), remember this: every `map` function you write has to be executed for every single document in your database. No exceptions.
If you only remember one thing from [my blog post about secondary indexes]({{ site.baseurl }}/2014/05/01/secondary-indexes-have-landed-in-pouchdb.html), remember this: every `map` function you write has to be executed for every single document in your database. No exceptions.

On the other hand, the `query()` options like `startkey`, `endkey`, `key`, and `keys` have been optimized to hell, and they leverage the native indexes in the database to deliver the maximum possible performance.

Expand Down Expand Up @@ -235,7 +235,7 @@ function getPostsBetween(startTime, endTime) {
}
```
(That `createDesignDoc()` helper function comes from [this blost post](http://pouchdb.com/2014/05/01/secondary-indexes-have-landed-in-pouchdb.html).)
(That `createDesignDoc()` helper function comes from [this blost post]({{ site.baseurl }}/2014/05/01/secondary-indexes-have-landed-in-pouchdb.html).)
Not only is the above code much simpler, but it's also faster and more tweakable. No need to completely rebuild the index when your query changes; just switch around `startkey`/`endkey`/`descending` and friends at query time to get the data you want.
Expand Down
2 changes: 1 addition & 1 deletion docs/_posts/2014-07-25-pouchdb-levels-up.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ This brings us back to Nick Thompson's [LevelUP proposal](https://github.com/pou

For instance, there was [a longstanding issue](https://github.com/pouchdb/pouchdb/issues/44) to add LocalStorage support for older browsers like IE 8 and 9. With LevelUP, we could avoid writing an entirely new, fourth adapter and simply plug into [localstorage-down](https://github.com/No9/localstorage-down). And it certainly wouldn't hurt to have Riak, Redis, or an in-memory database as potential backends.

There was some hemming and hawing (mostly from me), but in the end we decided to cruise ahead with the proposal. (And ultimately, I was happily proven wrong.) Calvin Metcalf deserves the primary credit for integrating [Sublevel](https://github.com/dominictarr/level-sublevel) into the LevelDB adapter, while Adam Shih jumped in to get the new adapter browserified with three different backends: localstorage-down, level-js, and MemDOWN. I put the finishing touches to build them as separate plugins, and as of 2.2.3 they're fully passing the test suite and [ready to use](http://pouchdb.com/adapters.html#pouchdb_in_the_browser).
There was some hemming and hawing (mostly from me), but in the end we decided to cruise ahead with the proposal. (And ultimately, I was happily proven wrong.) Calvin Metcalf deserves the primary credit for integrating [Sublevel](https://github.com/dominictarr/level-sublevel) into the LevelDB adapter, while Adam Shih jumped in to get the new adapter browserified with three different backends: localstorage-down, level-js, and MemDOWN. I put the finishing touches to build them as separate plugins, and as of 2.2.3 they're fully passing the test suite and [ready to use]({{ site.baseurl }}/adapters.html#pouchdb_in_the_browser).

Additionally, [PouchDB Server](https://github.com/pouchdb/pouchdb-server) has been updated to allow the use of alternate backends via the `--level-backend` option. This provides an instant CouchDB REST API to any LevelUP-compliant datastore &ndash; Redis, Riak, MySQL, you name it. There's also a new `--in-memory` option, courtesy of MemDOWN, of course.

Expand Down
2 changes: 1 addition & 1 deletion docs/_posts/2014-09-04-pouchdb-3.0.4.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ author: Calvin Metcalf

---

This week we present [PouchDB 3.0.4](https://github.com/pouchdb/pouchdb/releases/tag/3.0.4), which fixes a bunch of stuff with attachments. Now the kittens generated by the [3.0.0 release](http://pouchdb.com/2014/08/12/pouchdb-3.0.0.html) may be safely stored in Pouch.
This week we present [PouchDB 3.0.4](https://github.com/pouchdb/pouchdb/releases/tag/3.0.4), which fixes a bunch of stuff with attachments. Now the kittens generated by the [3.0.0 release]({{ site.baseurl }}/2014/08/12/pouchdb-3.0.0.html) may be safely stored in Pouch.

{% include img.html src="kittens_small.jpg" alt="Kittens" %}

Expand Down
Loading

0 comments on commit 0d77397

Please sign in to comment.