Hi Stefan,

Yes, Mango indexes are stored in design documents. The POST /db/_index endpoint 
accepts a “ddoc” query parameter that allows you to specify the ID of the 
document where you want to store the index. If you don’t specify that parameter 
a new doc is created automatically:

http://docs.couchdb.org/en/2.0.0/api/database/find.html#db-index 
<http://docs.couchdb.org/en/2.0.0/api/database/find.html#db-index>

If you already have the design document created you can replicate it in or use 
whatever ddoc management strategy you’ve been using with views to manage your 
Mango indexes as well. Cheers,

Adam

> On Jan 26, 2017, at 4:35 PM, Stefan du Fresne <[email protected]> wrote:
> 
> Hi,
> 
> In the same way you define views in the ddoc, is there any way of defining 
> mango indexes in the ddoc? If not, is there a pattern that is recommended for 
> getting them deployed to be used that I’m missing? Or is it expected that 
> when you use these indexes you’re responsible for some code that checks to 
> see if they already exist and then adds them if they aren’t at some point in 
> your application?
> 
> Cheers,
> Stefan

Reply via email to