eddelplus / cornercouch Goto Github PK
View Code? Open in Web Editor NEWCornerCouch - AngularJS module for CouchDB
License: MIT License
CornerCouch - AngularJS module for CouchDB
License: MIT License
This would be convenient for use with npm - currently with no package.json, I can't install CornerCouch even direct from the git repository (which npm supports only if there is a package.json).
There is a workaround using napa which I'm about to try, but a package.json should be simple to create using npm init
.
Of course, submitting the resulting CornerCouch package to the npm repository would make it even more convenient to use!
Thanks.
Hi,
is it possible to have the "save" function on the returning docs from the query function:
$scope.gbookdb.query("app", "utc_only", { include_docs: true, descending: true, limit: 8 });
My goal is to update docs that i have from the query without having to get the doc again by the Id to save it to database. I don't know if I can do this in some way, but i couldn't find it.
Thank you.
What is the potential for supporting CouchDB 1.3's CORS feature for cross site?
I really like the "queryNext()" feature, but it would be great if there was a boolean field, say "processingQueryNext", that would set to true when queryNext() is called and to false when the answer returns.
This would be very useful, for example, to set the "next" button's text to "loading..." during the process.
Not an issue, really a question - how do I create a custom view? e.g.
function(employee, meta) {
if (employee.pin == appPinCode)
{
emit(employee.firstName,employee.lastName);
}
}
this will be useful when instead of a paging system you use "infinite scrolling".
Just use:
ng-repeat="row in db.rows"
to display the whole accumulated list of rows.
Had some hickups to get CORS running properly on Iris Couch.
The GUI tools didn't cut it and this set of commands did the trick:
curl -X PUT http://username:[email protected]/_config/httpd/enable_cors -d '"true"'
curl -X PUT http://username:[email protected]/_config/cors/origins -d '"*"'
curl -X PUT http://username:[email protected]/_config/cors/credentials -d '"true"'
curl -X PUT http://username:[email protected]/_config/cors/methods -d '"GET, PUT, POST, HEAD, DELETE"'
curl -X PUT http://username:[email protected]/_config/cors/headers -d '"accept, authorization, content-type, origin"'
curl -XPOST -HContent-Type:application/json https://username:[email protected]/_restart
Might be handy to add to the wiki somewhere.
is this possible with CornerCouch? I would like to PUT this sample object {"_id": "org.couchdb.user:wubble","name": "wubble","roles": [],"type": "user","password": "tubble"} and create new user
One approach for getting started and understanding AngularJS + CornerCouch + CouchDB (the one I'm trying) is replicating http://eddelplus.iriscouch.com/gbook1 into ones own Couch instance, and modifying the example to ones own content.
Has anyone tried this approach and documented the steps for getting a working result?
Hi,
I'm using CouchDB through an HTTP proxy '/docs' on the backend.
Everything works fine for reads when I use:
$scope.server = cornercouch('/docs','GET');
But I want to use the doc.save() method using POST & PUT.
when I use:
$scope.server = cornercouch('/docs','POST');
It doesn't send the data using Content-Type: 'application/json'
and I get a server error.
I'm using a django backend.
I tried to work around this using:
$http.defaults.headers.post['Content-Type'] = 'application/json';
but no avail
Not even sure you're using $http
Can you tell me how to get around this problem?
Since all requests towards the couchdb server are made using jsonp, no PUT/POST. So my question is is there any way to call an update function using cornercouch if the database is on a different domain than the app?
Hi,
first of all this project is really impressive.
I replicated your database in https://vbrajon.iriscouch.com/gbook1/_design/app/guestbook.html and this is working.
BUT, when i request my iriscouch database in a local development environment, I get an "Uncaught SyntaxError: Unexpected token : " at line 1.
This is probably due to the custom response that your couchdb server is serving when you specify the callback parameter (needed by the angular $http service) :
curl -vX GET http://eddelplus.iriscouch.com/gbook1/_all_docs?callback=testcallback
Then the response is :
/* CouchDB */testcallback({"total_rows":22...);
Or, by default my response is :
{"total_rows":16...}
Here is my code requesting both database, your db is working and mine don't :
// YOUR DATABASE
$scope.server = cornercouch('http://eddelplus.iriscouch.com');
$scope.gbookdb = $scope.server.getDB('gbook1');
$scope.gbookdb.queryAll();
// MY DATABASE
$scope.server = cornercouch('http://vbrajon.iriscouch.com');
$scope.gbookdb = $scope.server.getDB('gbook1');
$scope.gbookdb.queryAll();
Have you specified any view functions or specific configuration in CouchDB ?
Have you any clue to return the right response (wrap content by callback();) ?
Thank you in advance !
Is there a changes feed in this bridge I can subscribe to?
Hello,
thank you very much. CornerCouch makes it very easy to access CouchDB from AngularJS.
However, I have a question regarding $scope.server.getDB('dbname'):
I'm using it within a CouchApp. I would guess that I can skip mentioning the dbname explicitly, as I want to use the same database which servers the CouchApp.
Do I have to parse the URL by hand to avoid mentioning the dbname explicitly in the App?
Any hints would be appreciated.
Sven
Consequentially CornerCouch will no longer support newer versions of AngularJS from about 1.5.9 (at which point the deprecation seems to have become non-support). I now see this error with AngularJS 1.6.1:
Error: $http(...).success is not a function
The encodeUri(base, part1, part2)
function does not permit document-ids with slashes in them, like example/12345
since it does a general uri.replace('%2F', '/');
before returning.
I get the following error when I try to call db_obj.getDoc(id):
Uncaught SyntaxError: Unexpected token :
I am able to get the expected document object if I create a new document using .newDoc(), but then if I take that object's _id
and use it as the argument for .getDoc() then I get the same error.
doc = database.newDoc();
doc.save();
here is my code
$scope.server = server = cornercouch("http://127.0.0.1:5984");
database = $scope.server.getDB("rbma_articles");
console.log("database: ", database)
$scope.getDoc = function() {
//hardcoded ID
id = "8760e498a7d8e963187653179000e65f"
doc = database.getDoc(id)
}
note: I am using globals so I can access the objects from the console.
Has anyone else run into this issue/is there something I'm doing wrong here or is this a bug?
I believe you should provide some information regarding enabling JSONP on couchdb. So that the JSONP call made by user should not get error out if server returns JSON data.
Or we should put some console message to make user aware that the server is sending JSON data and he/she is trying to read JSONP data..
Just tried bower install angular-cornercouch --save with no luck. Any thoughts?
I am having quite a lot of trouble trying to figure out how to interface with couchdbs cookie authentication using your library. I cannot get the value of the AuthSession unless I am actually logged into futon when I use my app (under the same credentials I use to login to futon)
Hi,
I'm just starting to use CornerCouch, and there is something I don't quite understand.
After a query
, the resulting rows can be accessed via the db.rows
attribute. Therefore, only one request per-database can be made at the same time, which is very unhandy.
As a workaround, I was thinking that the query
method could accept a variable as parameter which will hold the result of the query instead of db
.
The doc says :
You can get yourself multiple database objects form CornerCouch based on the same database if you need to work with multiple views.
But how do you do that without re-calling getDB
? And isn't it overkill to create two instances of the database just to make two queries ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.