ashleydavis / mongodb-rest

REST Server for MongoDB (using node.js)
GNU Lesser General Public License v3.0
75 stars 34 forks source link

Mongodb dont update collection #13

Closed marcoriesco closed 9 years ago

marcoriesco commented 9 years ago

I am unable to update any field of my project , since moving to MongoDB , I'm using server mongodb-rest REST API.

My function send and receive data return , but do not write in mongodb database .

I would like to help on this.

I using Restangular, and my code for get and update is:

$scope.updateItem = function(){
      $http.put(API.db+ '/' +$scope.section+ '/' +$scope.item._id, $scope.item)
        .then(function(response) {
            //var id = getID(response.headers('Location'));
            //$state.go('admin.editItem', {section: $scope.section, id: id});
            console.log(response);
        })
        .catch(function(err, status) {
            toast.msgToast($scope.section + ' ...ocorreu um erro ao criar o item!');
        })
        .finally(function(){
            toast.msgToast($scope.section + ' ...item atualizado!');
        });

};

$scope.loadItem = function(){
    ApiRestangular.one($scope.section, $stateParams.id).get().then(function(item) {
        $scope.item = item;
    });
};
ashleydavis commented 9 years ago

I'm sorry I don't understand the issue.

Please describe your setup, your code and what you are trying to achieve.

If you can provide a link to a zip containing an example I'll have a lot at if for you.

ashleydavis commented 9 years ago

I am closing this as the referenced Stack Overflow page no longer exists. If you continue to have the issue please reopen it.

marcoriesco commented 9 years ago

The problem persists, dont update, send me a response with success, but in mongodb, nothing changed

ashleydavis commented 9 years ago

If you can give me more information I'll have a look.

How are you running mongdb-rest? What config are you using?

Please give me an example or a URL that you are using to update the database.

marcoriesco commented 9 years ago

I am using OSX 10.10.5.

I've tried all kinds of code to update and all to no success.

$scope.updateItem = function(){
    $scope.item.put().then(function(res){
        //$scope.item._etag.$oid = res._etag;
        $scope.loadItem();
        toast.msgToast($scope.section+ ' #' +$scope.item._id.$oid+ ' ....Atualizado!');
    });
};