.getDoc() isn't working
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?
This happens when cornercouch expects to get JSON-P back from the server but instead gets plain JSON. I solved this by adding an extra "GET" parameter to the cornercouch() function call, like this:
cornercouch("http://127.0.0.1:5984", "GET");