Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Design Functions #15

Closed
tverilytt opened this issue Apr 27, 2016 · 3 comments
Closed

Support for Design Functions #15

tverilytt opened this issue Apr 27, 2016 · 3 comments

Comments

@tverilytt
Copy link

Hi!
It would be very convenient to get support for CouchDB Design Functions (Map, Reduce...) in the loopback-connector-cloudant. Design Functions are core to CouchDB, and supporting them, will e.g. make it easier to switch between local CouchDB database, and Cloudant database in the cloud.

CouchDB documentation on Design Functions:
http://docs.couchdb.org/en/1.6.1/couchapp/ddocs.html?highlight=map%20reduce

With best regards
-jo2

@tonyffrench
Copy link
Contributor

Using Cloudant Query vs CouchDB Views are two very different but equally important approaches. We have two choices: 1) enhance this connector to support MapReduce etc. 2) enhance https://github.com/mattange/loopback-connector-couch

IMO, given that the MapReduce approach is so different it would be cleaner to keep these implementations separate.

Thoughts?

@jannyHou
Copy link
Contributor

jannyHou commented May 12, 2017

Hi @tonyffrench I am trying to support querying view in a loopback model, and come across problem when creating a view in a lb-model's design document.

When I read your comments above I think maybe you could share more insight here, any help or clue are appreciated :)

Now the connector creates index with type=text(to support cloudant query), and the design doc of the index has language: 'query' by default, which throws error when I try to save a view with String type map function, so my question is:

  • Can I specify other design doc languages when creating a text type index? Or it only supports language 'query'?

  • If language 'query' is the only choice, is it possible to create a view with object type value of map, which can still be interpreted as a map function?

I searched through the cloduant&couchdb document, but find very few explanations regarding these.

If "full text search" and "map-reduce" could not exist in same design document, I think I can support those design functions like view as datasource level functions, so a view don't need to be created in a lb-model's design doc.
Or use two design docs(one for index one for view) to represent a loopback model.
While I am still curious is it possible to support both in same design doc.

Thanks in advance!


UPDATE
Get confirmed from Cloduant core team, unfortunately they are not compatible in same design doc.
Will implement view as a datasource level api.

@kjdelisle
Copy link
Contributor

Closing this. See #67 for progress on this item.

@dhmlau dhmlau added this to the Sprint 36 - Apex milestone May 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants