Riak.mapValuesJson is returning a string

Brian Shumate bshumate at basho.com
Wed May 16 08:48:38 EDT 2012


Hello,

I am running a Riak 1.1.2 rel build from source on OS X 10.7 with Erlang R14B04, and just tried a case like yours, but I cannot reproduce your issue:

curl -v -d '{"name": "Brian"}' -H "Content-Type: application/json" http://127.0.0.1:8098/riak/test/120000

    * About to connect() to 127.0.0.1 port 8098 (#0)
    *   Trying 127.0.0.1... connected
    * Connected to 127.0.0.1 (127.0.0.1) port 8098 (#0)
    > POST /riak/test/120000 HTTP/1.1
    > User-Agent: curl/7.21.4 (universal-apple-darwin11.0) libcurl/7.21.4 OpenSSL/0.9.8r zlib/1.2.5
    > Host: 127.0.0.1:8098
    > Accept: */*
    > Content-Type: application/json
    > Content-Length: 28
    >
    < HTTP/1.1 204 No Content
    < Vary: Accept-Encoding
    < Server: MochiWeb/1.1 WebMachine/1.9.0 (someone had painted it blue)
    < Date: Sun, 13 May 2012 19:50:49 GMT
    < Content-Type: application/json
    < Content-Length: 0
    <
    * Connection #0 to host 127.0.0.1 left intact
    * Closing connection #0

curl -i localhost:8098/riak/test/120000

    HTTP/1.1 200 OK
    X-Riak-Vclock: a85hYGBgzGDKBVIcypz/fvpv4P+QwZTImMfKMLNH5SRfFgA=
    Vary: Accept-Encoding
    Server: MochiWeb/1.1 WebMachine/1.9.0 (someone had painted it blue)
    Link: </riak/test>; rel="up"
    Last-Modified: Sun, 13 May 2012 19:50:49 GMT
    ETag: "hsUPQi54y1EKeXVazb3fl"
    Date: Sun, 13 May 2012 19:50:56 GMT
    Content-Type: application/json
    Content-Length: 28

    {"name": "Brian"}%

curl -v -d '{"inputs":[["test", "120000"]], "query":[{"map":{"language":"javascript", "source":"function(value, keyData, arg) { var dats = Riak.mapValuesJson(value)[0]; return [typeof dats];}"}}]}' -H "Content-Type: application/json" http://127.0.0.1:8098/mapred

    * About to connect() to 127.0.0.1 port 8098 (#0)
    *   Trying 127.0.0.1... connected
    * Connected to 127.0.0.1 (127.0.0.1) port 8098 (#0)
    > POST /mapred HTTP/1.1
    > User-Agent: curl/7.21.4 (universal-apple-darwin11.0) libcurl/7.21.4 OpenSSL/0.9.8r zlib/1.2.5
    > Host: 127.0.0.1:8098
    > Accept: */*
    > Content-Type: application/json
    > Content-Length: 184
    >
    < HTTP/1.1 200 OK
    < Server: MochiWeb/1.1 WebMachine/1.9.0 (someone had painted it blue)
    < Date: Sun, 13 May 2012 19:52:28 GMT
    < Content-Type: application/json
    < Content-Length: 10
    <
    * Connection #0 to host 127.0.0.1 left intact
    * Closing connection #0
    ["object"]%

As you can see above, I get the expected results.

What version of Riak are you using? What does the full (with -v) output of storing an object in your case look like?

Regards,

Brian

On May 16, 2012, at 8:40 AM, kodeblok wrote:

> Does anyone have any thoughts on this? I'm unable to perform MapReduce
> queries.
> 
> Thanks
> 
> --
> View this message in context: http://riak-users.197444.n3.nabble.com/Riak-mapValuesJson-is-returning-a-string-tp3942213p3996979.html
> Sent from the Riak Users mailing list archive at Nabble.com.
> 
> _______________________________________________
> riak-users mailing list
> riak-users at lists.basho.com
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com





More information about the riak-users mailing list