ionic framework - Create collections in cloudant -


i'm trying build ionic application retrieves data cloudant using pouchdb. cloudant allows creating databases , documents. how can create collections in cloudant?

two part answer:

a set of documents meet criteria can considered collection in cloudant/couchdb. can create views fetch documents. such view might check existence of property in document ("all documents property named type"), value of property ("all documents property named type having value of book") or other condition makes sense application , return appropriate documents.

you have follow 3 step process:

  • determine how can identify documents in database consider part of collection
  • create view based on findings in previous step
  • query view retrieve documents

above documentation link provides more details.

properties in document can represent collections well, in following example, defines simple array of strings.

{   "mycollectionname": [       "element1",       "element2",       ...   ] } 

how implement collections depends on use-case scenario.


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -