2014/1/7 Sander Elias <[email protected]>

> function RESTClient($scope, $resource) { $scope.URL=URL; $scope.data =
> $resource(URL, { callback:'JSON_CALLBACK'}, {get:{method:'JSONP'}});
> $scope.data.get(function (x) { $scope.users = x; console.log(x) }); }


=============================================================================
Fine, it works whith Python / Sleepy.Mongoose.
Because http://localhost:27080/test/users/_find gives :

{"ok": 1, "results": [{"_id": {"$oid": "52c7d8e20dd0bc6d1c000001"},
"name": "Yvonec"}, {"_id": {"$oid": "52c7d8e20dd0bc6d1c000002"},
"name": "Lilwenn"}, {"_id": {"$oid": "52cb22116d3c20e905f23239"},
"name": "Toto"}], "id": 2}

I've changed a bit the js :
...
               $scope.users = x.results;
               console.log("x = "+x)
               console.log("x.results = "+x.results)
...
log at server side :
$ rackup
[2014-01-07 12:55:47] INFO  WEBrick 1.3.1
[2014-01-07 12:55:47] INFO  ruby 2.0.0 (2013-02-08) [x86_64-darwin12.0.0]
[2014-01-07 12:55:47] INFO  WEBrick::HTTPServer#start: pid=4259 port=9292
127.0.0.1 - - [07/Jan/2014 12:56:08] "GET
/test/users?callback=angular.callbacks._0 HTTP/1.1" 200 183 0.0781
127.0.0.1 - - [07/Jan/2014 12:57:00] "GET
/test/users?callback=angular.callbacks._0 HTTP/1.1" 200 183 0.0458
127.0.0.1 - - [07/Jan/2014 12:57:09] "GET
/test/users?callback=angular.callbacks._0 HTTP/1.1" 200 183 0.0140
127.0.0.1 - - [07/Jan/2014 12:57:44] "GET
/test/users?callback=angular.callbacks._0 HTTP/1.1" 200 183 0.0268
127.0.0.1 - - [07/Jan/2014 13:07:08] "GET /test/users HTTP/1.1" 200 183
0.0188
127.0.0.1 - - [07/Jan/2014 13:09:08] "GET
/test/users?callback=angular.callbacks._0 HTTP/1.1" 200 183 0.0584

=============================================================================with
Ruby   / DrowsyDromedary :
http://localhost:9292/test/users

[{"name":"Yvonec","_id":{"$oid":
"52c7d8e20dd0bc6d1c000001"}},{"name":"Lilwenn","_id":{"$oid":
"52c7d8e20dd0bc6d1c000002"}},{"_id":{"$oid":
"52cb22116d3c20e905f23239"},"name":"Toto"}]

Resulting in NOTHING at console.log...

log at the server side :
$ python httpd.py

=================================
|      MongoDB REST Server      |
=================================

listening for connections on http://localhost:27080

1.0.0.127.in-addr.arpa - - [07/Jan/2014 12:59:45] "GET
/test/users/_find?callback=angular.callbacks._0 HTTP/1.1" 200 -
1.0.0.127.in-addr.arpa - - [07/Jan/2014 13:00:23] "GET
/test/users/_find HTTP/1.1" 200 -
1.0.0.127.in-addr.arpa - - [07/Jan/2014 13:01:38] "GET
/test/users/_find HTTP/1.1" 200 -
1.0.0.127.in-addr.arpa - - [07/Jan/2014 13:01:51] "GET
/test/users/_find?callback=angular.callbacks._0 HTTP/1.1" 200 -
1.0.0.127.in-addr.arpa - - [07/Jan/2014 13:02:33] "GET
/test/users/_find?callback=angular.callbacks._0 HTTP/1.1" 200 -


=============================================================================
and finally with NodeJS / mongodb-rest :
http://localhost:3000/test/users

[
  {
    "name": "Yvonec",
    "_id": "52c7d8e20dd0bc6d1c000001"
  },
  {
    "name": "Lilwenn",
    "_id": "52c7d8e20dd0bc6d1c000002"
  },
  {
    "_id": "52cb22116d3c20e905f23239",
    "name": "Toto"
  }
]

Resulting in NOTHING at console.log...

server log being :
$ mongodb-rest
Warning: express.createServer() is deprecated, express
applications no longer inherit from http.Server,
please use:

  var express = require("express");
  var app = express();

connect.multipart() will be removed in connect 3.0
visit https://github.com/senchalabs/connect/wiki/Connect-3.0 for alternatives
connect.limit() will be removed in connect 3.0
========================================================================================
=  Please ensure that you set the default write concern for the
database by setting    =
=   one of the options
                =
=
                =
=     w: (value of > -1 or the string 'majority'), where < 1 means
                =
=        no write acknowledgement
                 =
=     journal: true/false, wait for flush to journal before
acknowledgement             =
=     fsync: true/false, wait for flush to file system before
acknowledgement           =
=
                =
=  For backward compatibility safe is still supported and
                =
=   allows values of [true | false | {j:true} | {w:n, wtimeout:n} |
{fsync:true}]      =
=   the default value is false which means the driver receives does
not                =
=   return the information of the success/error of the
insert/update/remove            =
=
                =
=   ex: new Db(new Server('localhost', 27017), {safe:false})
                =
=
                =
=   http://www.mongodb.org/display/DOCS/getLastError+Command
                =
=
                =
=  The default of no acknowledgement will change in the very near
future                =
=
                =
=  This message will disappear when the default safe is set on the
driver Db           =
========================================================================================
127.0.0.1 - - [Tue, 07 Jan 2014 12:13:14 GMT] "GET /test/users
HTTP/1.1" 304 - "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8;
rv:29.0) Gecko/20100101 Firefox/29.0"

However looking the repos I've found :

Ruby   / DrowsyDromedary
latest change drowsy_dromedary.rb 5 months ago

Python / Sleepy.Mongoose
latest change is a year ago about Readme.md and 2 years ago for
sleepymongoose<https://github.com/10gen-labs/sleepy.mongoose/tree/master/sleepymongoose>
.

NodeJS / mongodb-rest
latest change is 3 years ago and
http://docs.mongodb.org/ecosystem/tools/http-interfaces/
still states :
MongoDB Rest <https://github.com/tdegrunt/mongodb-rest> is an *alpha* REST
interface to MongoDB that uses the MongoDB Node Native
driver<https://github.com/christkv/node-mongodb-native>
.







may be the REST specification itself isn't the same...

ANyway, thanks a lot for your help !

-- 
[email protected],2.384858688

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to