Skip to content

Instantly share code, notes, and snippets.

@yanatan16
Created March 6, 2016 21:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yanatan16/631ed7729e9eb144ce04 to your computer and use it in GitHub Desktop.
Save yanatan16/631ed7729e9eb144ce04 to your computer and use it in GitHub Desktop.
quasar-analytics/quasar#7
$ curl http://localhost:8080/data/fs/local/quasar/wide2{ "user_id": 8927524.0, "profile_name": "Mary Jane", "age": 29.0, "title": "Dr", "comment_id": "F2372BAC", "comment_text": "I concur.", "comment_reply_to_profile": 9817361.0, "comment_reply_to_comment": "F8ACD164F", "comment_time": "2015-02-03", "a1user_id": 8927524.0, "a1profile_name": "Mary Jane", "a1age": 29.0, "a1title": "Dr", "a1comment_id": "F2372BAC", "a1comment_text": "I concur.", "a1comment_reply_to_profile": 9817361.0, "a1comment_reply_to_comment": "F8ACD164F", "a1comment_time": "2015-02-03", "a2user_id": 8927524.0, "a2profile_name": "Mary Jane", "a2age": 29.0, "a2title": "Dr", "a2comment_id": "F2372BAC", "a2comment_text": "I concur.", "a2comment_reply_to_profile": 9817361.0, "a2comment_reply_to_comment": "F8ACD164F", "a2comment_time": "2015-02-03", "a3user_id": 8927524.0, "a3profile_name": "Mary Jane", "a3age": 29.0, "a3title": "Dr", "a3comment_id": "F2372BAC", "a3comment_text": "I concur.", "a3comment_reply_to_profile": 9817361.0, "a3comment_reply_to_comment": "F8ACD164F", "a3comment_time": "2015-02-03", "a4user_id": 8927524.0, "a4profile_name": "Mary Jane", "a4age": 29.0, "a4title": "Dr", "a4comment_id": "F2372BAC", "a4comment_text": "I concur.", "a4comment_reply_to_profile": 9817361.0, "a4comment_reply_to_comment": "F8ACD164F", "a4comment_time": "2015-02-03" }
{ "user_id": 8927524.0, "profile_name": "Mary Jane", "age": 29.0, "title": "Dr", "comment_id": "GH732AFC", "comment_text": "NA", "comment_reply_to_profile": 9654726.0, "comment_reply_to_comment": "A44124F", "comment_time": "2015-03-01", "a1user_id": 8927524.0, "a1profile_name": "Mary Jane", "a1age": 29.0, "a1title": "Dr", "a1comment_id": "GH732AFC", "a1comment_text": "NA", "a1comment_reply_to_profile": 9654726.0, "a1comment_reply_to_comment": "A44124F", "a1comment_time": "2015-03-01", "a2user_id": 8927524.0, "a2profile_name": "Mary Jane", "a2age": 29.0, "a2title": "Dr", "a2comment_id": "GH732AFC", "a2comment_text": "NA", "a2comment_reply_to_profile": 9654726.0, "a2comment_reply_to_comment": "A44124F", "a2comment_time": "2015-03-01", "a3user_id": 8927524.0, "a3profile_name": "Mary Jane", "a3age": 29.0, "a3title": "Dr", "a3comment_id": "GH732AFC", "a3comment_text": "NA", "a3comment_reply_to_profile": 9654726.0, "a3comment_reply_to_comment": "A44124F", "a3comment_time": "2015-03-01", "a4user_id": 8927524.0, "a4profile_name": "Mary Jane", "a4age": 29.0, "a4title": "Dr", "a4comment_id": "GH732AFC", "a4comment_text": "NA", "a4comment_reply_to_profile": 9654726.0, "a4comment_reply_to_comment": "A44124F", "a4comment_time": "2015-03-01" }
$ curl -v 'http://localhost:8080/query/fs/local/quasar/?q=SELECT%20%60userId%60%20AS%20%60user_id%60%2C%20%60profile%60.%60name%60%20AS%20%60profile_name%60%2C%20%60profile%60.%60age%60%20AS%20%60age%60%2C%20%60profile%60.%60title%60%20AS%20%60title%60%2C%20%60comments%60%5B*%5D.%60id%60%20AS%20%60comment_id%60%2C%20%60comments%60%5B*%5D.%60text%60%20AS%20%60comment_text%60%2C%20%60comments%60%5B*%5D.%60replyTo%60%5B0%5D%20AS%20%60comment_reply_to_profile%60%2C%20%60comments%60%5B*%5D.%60replyTo%60%5B1%5D%20AS%20%60comment_reply_to_comment%60%2C%20%60comments%60%5B*%5D.%60time%60%20AS%20%60comment_time%60%2C%20%60userId%60%20AS%20%60a1user_id%60%2C%20%60profile%60.%60name%60%20AS%20%60a1profile_name%60%2C%20%60profile%60.%60age%60%20AS%20%60a1age%60%2C%20%60profile%60.%60title%60%20AS%20%60a1title%60%2C%20%60comments%60%5B*%5D.%60id%60%20AS%20%60a1comment_id%60%2C%20%60comments%60%5B*%5D.%60text%60%20AS%20%60a1comment_text%60%2C%20%60comments%60%5B*%5D.%60replyTo%60%5B0%5D%20AS%20%60a1comment_reply_to_profile%60%2C%20%60comments%60%5B*%5D.%60replyTo%60%5B1%5D%20AS%20%60a1comment_reply_to_comment%60%2C%20%60comments%60%5B*%5D.%60time%60%20AS%20%60a1comment_time%60%2C%20%60userId%60%20AS%20%60a2user_id%60%2C%20%60profile%60.%60name%60%20AS%20%60a2profile_name%60%2C%20%60profile%60.%60age%60%20AS%20%60a2age%60%2C%20%60profile%60.%60title%60%20AS%20%60a2title%60%2C%20%60comments%60%5B*%5D.%60id%60%20AS%20%60a2comment_id%60%2C%20%60comments%60%5B*%5D.%60text%60%20AS%20%60a2comment_text%60%2C%20%60comments%60%5B*%5D.%60replyTo%60%5B0%5D%20AS%20%60a2comment_reply_to_profile%60%2C%20%60comments%60%5B*%5D.%60replyTo%60%5B1%5D%20AS%20%60a2comment_reply_to_comment%60%2C%20%60comments%60%5B*%5D.%60time%60%20AS%20%60a2comment_time%60%2C%20%60userId%60%20AS%20%60a3user_id%60%2C%20%60profile%60.%60name%60%20AS%20%60a3profile_name%60%2C%20%60profile%60.%60age%60%20AS%20%60a3age%60%2C%20%60profile%60.%60title%60%20AS%20%60a3title%60%2C%20%60comments%60%5B*%5D.%60id%60%20AS%20%60a3comment_id%60%2C%20%60comments%60%5B*%5D.%60text%60%20AS%20%60a3comment_text%60%2C%20%60comments%60%5B*%5D.%60replyTo%60%5B0%5D%20AS%20%60a3comment_reply_to_profile%60%2C%20%60comments%60%5B*%5D.%60replyTo%60%5B1%5D%20AS%20%60a3comment_reply_to_comment%60%2C%20%60comments%60%5B*%5D.%60time%60%20AS%20%60a3comment_time%60%2C%20%60userId%60%20AS%20%60a4user_id%60%2C%20%60profile%60.%60name%60%20AS%20%60a4profile_name%60%2C%20%60profile%60.%60age%60%20AS%20%60a4age%60%2C%20%60profile%60.%60title%60%20AS%20%60a4title%60%2C%20%60comments%60%5B*%5D.%60id%60%20AS%20%60a4comment_id%60%2C%20%60comments%60%5B*%5D.%60text%60%20AS%20%60a4comment_text%60%2C%20%60comments%60%5B*%5D.%60replyTo%60%5B0%5D%20AS%20%60a4comment_reply_to_profile%60%2C%20%60comments%60%5B*%5D.%60replyTo%60%5B1%5D%20AS%20%60a4comment_reply_to_comment%60%2C%20%60comments%60%5B*%5D.%60time%60%20AS%20%60a4comment_time%60%20FROM%20%60user_comments%60'
* Trying ::1...
* Connected to localhost (::1) port 8080 (#0)
> GET /query/fs/local/quasar/?q=SELECT%20%60userId%60%20AS%20%60user_id%60%2C%20%60profile%60.%60name%60%20AS%20%60profile_name%60%2C%20%60profile%60.%60age%60%20AS%20%60age%60%2C%20%60profile%60.%60title%60%20AS%20%60title%60%2C%20%60comments%60%5B*%5D.%60id%60%20AS%20%60comment_id%60%2C%20%60comments%60%5B*%5D.%60text%60%20AS%20%60comment_text%60%2C%20%60comments%60%5B*%5D.%60replyTo%60%5B0%5D%20AS%20%60comment_reply_to_profile%60%2C%20%60comments%60%5B*%5D.%60replyTo%60%5B1%5D%20AS%20%60comment_reply_to_comment%60%2C%20%60comments%60%5B*%5D.%60time%60%20AS%20%60comment_time%60%2C%20%60userId%60%20AS%20%60a1user_id%60%2C%20%60profile%60.%60name%60%20AS%20%60a1profile_name%60%2C%20%60profile%60.%60age%60%20AS%20%60a1age%60%2C%20%60profile%60.%60title%60%20AS%20%60a1title%60%2C%20%60comments%60%5B*%5D.%60id%60%20AS%20%60a1comment_id%60%2C%20%60comments%60%5B*%5D.%60text%60%20AS%20%60a1comment_text%60%2C%20%60comments%60%5B*%5D.%60replyTo%60%5B0%5D%20AS%20%60a1comment_reply_to_profile%60%2C%20%60comments%60%5B*%5D.%60replyTo%60%5B1%5D%20AS%20%60a1comment_reply_to_comment%60%2C%20%60comments%60%5B*%5D.%60time%60%20AS%20%60a1comment_time%60%2C%20%60userId%60%20AS%20%60a2user_id%60%2C%20%60profile%60.%60name%60%20AS%20%60a2profile_name%60%2C%20%60profile%60.%60age%60%20AS%20%60a2age%60%2C%20%60profile%60.%60title%60%20AS%20%60a2title%60%2C%20%60comments%60%5B*%5D.%60id%60%20AS%20%60a2comment_id%60%2C%20%60comments%60%5B*%5D.%60text%60%20AS%20%60a2comment_text%60%2C%20%60comments%60%5B*%5D.%60replyTo%60%5B0%5D%20AS%20%60a2comment_reply_to_profile%60%2C%20%60comments%60%5B*%5D.%60replyTo%60%5B1%5D%20AS%20%60a2comment_reply_to_comment%60%2C%20%60comments%60%5B*%5D.%60time%60%20AS%20%60a2comment_time%60%2C%20%60userId%60%20AS%20%60a3user_id%60%2C%20%60profile%60.%60name%60%20AS%20%60a3profile_name%60%2C%20%60profile%60.%60age%60%20AS%20%60a3age%60%2C%20%60profile%60.%60title%60%20AS%20%60a3title%60%2C%20%60comments%60%5B*%5D.%60id%60%20AS%20%60a3comment_id%60%2C%20%60comments%60%5B*%5D.%60text%60%20AS%20%60a3comment_text%60%2C%20%60comments%60%5B*%5D.%60replyTo%60%5B0%5D%20AS%20%60a3comment_reply_to_profile%60%2C%20%60comments%60%5B*%5D.%60replyTo%60%5B1%5D%20AS%20%60a3comment_reply_to_comment%60%2C%20%60comments%60%5B*%5D.%60time%60%20AS%20%60a3comment_time%60%2C%20%60userId%60%20AS%20%60a4user_id%60%2C%20%60profile%60.%60name%60%20AS%20%60a4profile_name%60%2C%20%60profile%60.%60age%60%20AS%20%60a4age%60%2C%20%60profile%60.%60title%60%20AS%20%60a4title%60%2C%20%60comments%60%5B*%5D.%60id%60%20AS%20%60a4comment_id%60%2C%20%60comments%60%5B*%5D.%60text%60%20AS%20%60a4comment_text%60%2C%20%60comments%60%5B*%5D.%60replyTo%60%5B0%5D%20AS%20%60a4comment_reply_to_profile%60%2C%20%60comments%60%5B*%5D.%60replyTo%60%5B1%5D%20AS%20%60a4comment_reply_to_comment%60%2C%20%60comments%60%5B*%5D.%60time%60%20AS%20%60a4comment_time%60%20FROM%20%60user_comments%60 HTTP/1.1
> Host: localhost:8080
> User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)
> Accept: */*
> Referer:
>
< HTTP/1.1 400 Bad Request
< Connection: close
< Content-Length: 0
< Date: Sun, 06 Mar 2016 21:34:52 UTC
<
* Closing connection 0
$ curl -v localhost:8080/query/fs/local/quasar/ -XPOST -H'Destination: wide2' -d'SELECT `userId` AS `user_id`, `profile`.`name` AS `profile_name`, `profile`.`age` AS `age`, `profile`.`title` AS `title`, `comments`[*].`id` AS `comment_id`, `comments`[*].`text` AS `comment_text`, `comments`[*].`replyTo`[0] AS `comment_reply_to_profile`, `comments`[*].`replyTo`[1] AS `comment_reply_to_comment`, `comments`[*].`time` AS `comment_time`, `userId` AS `a1user_id`, `profile`.`name` AS `a1profile_name`, `profile`.`age` AS `a1age`, `profile`.`title` AS `a1title`, `comments`[*].`id` AS `a1comment_id`, `comments`[*].`text` AS `a1comment_text`, `comments`[*].`replyTo`[0] AS `a1comment_reply_to_profile`, `comments`[*].`replyTo`[1] AS `a1comment_reply_to_comment`, `comments`[*].`time` AS `a1comment_time`, `userId` AS `a2user_id`, `profile`.`name` AS `a2profile_name`, `profile`.`age` AS `a2age`, `profile`.`title` AS `a2title`, `comments`[*].`id` AS `a2comment_id`, `comments`[*].`text` AS `a2comment_text`, `comments`[*].`replyTo`[0] AS `a2comment_reply_to_profile`, `comments`[*].`replyTo`[1] AS `a2comment_reply_to_comment`, `comments`[*].`time` AS `a2comment_time`, `userId` AS `a3user_id`, `profile`.`name` AS `a3profile_name`, `profile`.`age` AS `a3age`, `profile`.`title` AS `a3title`, `comments`[*].`id` AS `a3comment_id`, `comments`[*].`text` AS `a3comment_text`, `comments`[*].`replyTo`[0] AS `a3comment_reply_to_profile`, `comments`[*].`replyTo`[1] AS `a3comment_reply_to_comment`, `comments`[*].`time` AS `a3comment_time`, `userId` AS `a4user_id`, `profile`.`name` AS `a4profile_name`, `profile`.`age` AS `a4age`, `profile`.`title` AS `a4title`, `comments`[*].`id` AS `a4comment_id`, `comments`[*].`text` AS `a4comment_text`, `comments`[*].`replyTo`[0] AS `a4comment_reply_to_profile`, `comments`[*].`replyTo`[1] AS `a4comment_reply_to_comment`, `comments`[*].`time` AS `a4comment_time` FROM `user_comments`' >/dev/null
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Trying ::1...
* Connected to localhost (::1) port 8080 (#0)
> POST /query/fs/local/quasar/ HTTP/1.1
> Host: localhost:8080
> User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)
> Accept: */*
> Referer:
> Destination: wide2
> Content-Length: 1833
> Content-Type: application/x-www-form-urlencoded
> Expect: 100-continue
>
* Done waiting for 100-continue
0 1833 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0} [1833 bytes data]
* We are completely uploaded and fine
< HTTP/1.1 200 OK
< Content-Type: application/json; charset=UTF-8
< Date: Sun, 06 Mar 2016 21:35:47 UTC
< Transfer-Encoding: chunked
<
{ [16253 bytes data]
100 309k 0 307k 100 1833 231k 1379 0:00:01 0:00:01 --:--:-- 231k
* Connection #0 to host localhost left intact
SELECT
`userId` AS `user_id`, `profile`.`name` AS `profile_name`, `profile`.`age` AS `age`, `profile`.`title` AS `title`, `comments`[*].`id` AS `comment_id`, `comments`[*].`text` AS `comment_text`, `comments`[*].`replyTo`[0] AS `comment_reply_to_profile`, `comments`[*].`replyTo`[1] AS `comment_reply_to_comment`, `comments`[*].`time` AS `comment_time`
, `userId` AS `a1user_id`, `profile`.`name` AS `a1profile_name`, `profile`.`age` AS `a1age`, `profile`.`title` AS `a1title`, `comments`[*].`id` AS `a1comment_id`, `comments`[*].`text` AS `a1comment_text`, `comments`[*].`replyTo`[0] AS `a1comment_reply_to_profile`, `comments`[*].`replyTo`[1] AS `a1comment_reply_to_comment`, `comments`[*].`time` AS `a1comment_time`
, `userId` AS `a2user_id`, `profile`.`name` AS `a2profile_name`, `profile`.`age` AS `a2age`, `profile`.`title` AS `a2title`, `comments`[*].`id` AS `a2comment_id`, `comments`[*].`text` AS `a2comment_text`, `comments`[*].`replyTo`[0] AS `a2comment_reply_to_profile`, `comments`[*].`replyTo`[1] AS `a2comment_reply_to_comment`, `comments`[*].`time` AS `a2comment_time`
, `userId` AS `a3user_id`, `profile`.`name` AS `a3profile_name`, `profile`.`age` AS `a3age`, `profile`.`title` AS `a3title`, `comments`[*].`id` AS `a3comment_id`, `comments`[*].`text` AS `a3comment_text`, `comments`[*].`replyTo`[0] AS `a3comment_reply_to_profile`, `comments`[*].`replyTo`[1] AS `a3comment_reply_to_comment`, `comments`[*].`time` AS `a3comment_time`
, `userId` AS `a4user_id`, `profile`.`name` AS `a4profile_name`, `profile`.`age` AS `a4age`, `profile`.`title` AS `a4title`, `comments`[*].`id` AS `a4comment_id`, `comments`[*].`text` AS `a4comment_text`, `comments`[*].`replyTo`[0] AS `a4comment_reply_to_profile`, `comments`[*].`replyTo`[1] AS `a4comment_reply_to_comment`, `comments`[*].`time` AS `a4comment_time`
FROM `user_comments`
💪 SELECT `userId` AS `user_id`, `profile`.`name` AS `profile_name`, `profile`.`age` AS `age`, `profile`.`title` AS `title`, `comments`[*].`id` AS `comment_id`, `comments`[*].`text` AS `comment_text`, `comments`[*].`replyTo`[0] AS `comment_reply_to_profile`, `comments`[*].`replyTo`[1] AS `comment_reply_to_comment`, `comments`[*].`time` AS `comment_time`, `userId` AS `a1user_id`, `profile`.`name` AS `a1profile_name`, `profile`.`age` AS `a1age`, `profile`.`title` AS `a1title`, `comments`[*].`id` AS `a1comment_id`, `comments`[*].`text` AS `a1comment_text`, `comments`[*].`replyTo`[0] AS `a1comment_reply_to_profile`, `comments`[*].`replyTo`[1] AS `a1comment_reply_to_comment`, `comments`[*].`time` AS `a1comment_time`, `userId` AS `a2user_id`, `profile`.`name` AS `a2profile_name`, `profile`.`age` AS `a2age`, `profile`.`title` AS `a2title`, `comments`[*].`id` AS `a2comment_id`, `comments`[*].`text` AS `a2comment_text`, `comments`[*].`replyTo`[0] AS `a2comment_reply_to_profile`, `comments`[*].`replyTo`[1] AS `a2comment_reply_to_comment`, `comments`[*].`time` AS `a2comment_time`, `userId` AS `a3user_id`, `profile`.`name` AS `a3profile_name`, `profile`.`age` AS `a3age`, `profile`.`title` AS `a3title`, `comments`[*].`id` AS `a3comment_id`, `comments`[*].`text` AS `a3comment_text`, `comments`[*].`replyTo`[0] AS `a3comment_reply_to_profile`, `comments`[*].`replyTo`[1] AS `a3comment_reply_to_comment`, `comments`[*].`time` AS `a3comment_time`, `userId` AS `a4user_id`, `profile`.`name` AS `a4profile_name`, `profile`.`age` AS `a4age`, `profile`.`title` AS `a4title`, `comments`[*].`id` AS `a4comment_id`, `comments`[*].`text` AS `a4comment_text`, `comments`[*].`replyTo`[0] AS `a4comment_reply_to_profile`, `comments`[*].`replyTo`[1] AS `a4comment_reply_to_comment`, `comments`[*].`time` AS `a4comment_time` FROM `user_comments`
Mongo
db.user_comments.aggregate(
[
{
"$project": {
"__tmp8": {
"$cond": [
{
"$and": [
{ "$lte": [{ "$literal": [] }, "$comments"] },
{ "$lt": ["$comments", { "$literal": BinData(0, "") }] }]
},
"$comments",
{ "$literal": [undefined] }]
},
"__tmp9": "$$ROOT"
}
},
{ "$unwind": "$__tmp8" },
{ "$project": { "__tmp8": true, "__tmp9": true, "_id": false } },
{ "$out": "tmp.gen_1" }],
{ "allowDiskUse": true });
db.tmp.gen_1.mapReduce(
function () {
emit.apply(
null,
(function (key, value) {
return [
key,
{
"user_id": value.__tmp9.userId,
"profile_name": (isObject(value.__tmp9.profile) && (! Array.isArray(value.__tmp9.profile))) ? value.__tmp9.profile.name : undefined,
"age": (isObject(value.__tmp9.profile) && (! Array.isArray(value.__tmp9.profile))) ? value.__tmp9.profile.age : undefined,
"title": (isObject(value.__tmp9.profile) && (! Array.isArray(value.__tmp9.profile))) ? value.__tmp9.profile.title : undefined,
"comment_id": value.__tmp8.id,
"comment_text": value.__tmp8.text,
"comment_reply_to_profile": Array.isArray(value.__tmp8.replyTo) ? value.__tmp8.replyTo[0] : undefined,
"comment_reply_to_comment": Array.isArray(value.__tmp8.replyTo) ? value.__tmp8.replyTo[1] : undefined,
"comment_time": value.__tmp8.time,
"a1user_id": value.__tmp9.userId,
"a1profile_name": (isObject(value.__tmp9.profile) && (! Array.isArray(value.__tmp9.profile))) ? value.__tmp9.profile.name : undefined,
"a1age": (isObject(value.__tmp9.profile) && (! Array.isArray(value.__tmp9.profile))) ? value.__tmp9.profile.age : undefined,
"a1title": (isObject(value.__tmp9.profile) && (! Array.isArray(value.__tmp9.profile))) ? value.__tmp9.profile.title : undefined,
"a1comment_id": value.__tmp8.id,
"a1comment_text": value.__tmp8.text,
"a1comment_reply_to_profile": Array.isArray(value.__tmp8.replyTo) ? value.__tmp8.replyTo[0] : undefined,
"a1comment_reply_to_comment": Array.isArray(value.__tmp8.replyTo) ? value.__tmp8.replyTo[1] : undefined,
"a1comment_time": value.__tmp8.time,
"a2user_id": value.__tmp9.userId,
"a2profile_name": (isObject(value.__tmp9.profile) && (! Array.isArray(value.__tmp9.profile))) ? value.__tmp9.profile.name : undefined,
"a2age": (isObject(value.__tmp9.profile) && (! Array.isArray(value.__tmp9.profile))) ? value.__tmp9.profile.age : undefined,
"a2title": (isObject(value.__tmp9.profile) && (! Array.isArray(value.__tmp9.profile))) ? value.__tmp9.profile.title : undefined,
"a2comment_id": value.__tmp8.id,
"a2comment_text": value.__tmp8.text,
"a2comment_reply_to_profile": Array.isArray(value.__tmp8.replyTo) ? value.__tmp8.replyTo[0] : undefined,
"a2comment_reply_to_comment": Array.isArray(value.__tmp8.replyTo) ? value.__tmp8.replyTo[1] : undefined,
"a2comment_time": value.__tmp8.time,
"a3user_id": value.__tmp9.userId,
"a3profile_name": (isObject(value.__tmp9.profile) && (! Array.isArray(value.__tmp9.profile))) ? value.__tmp9.profile.name : undefined,
"a3age": (isObject(value.__tmp9.profile) && (! Array.isArray(value.__tmp9.profile))) ? value.__tmp9.profile.age : undefined,
"a3title": (isObject(value.__tmp9.profile) && (! Array.isArray(value.__tmp9.profile))) ? value.__tmp9.profile.title : undefined,
"a3comment_id": value.__tmp8.id,
"a3comment_text": value.__tmp8.text,
"a3comment_reply_to_profile": Array.isArray(value.__tmp8.replyTo) ? value.__tmp8.replyTo[0] : undefined,
"a3comment_reply_to_comment": Array.isArray(value.__tmp8.replyTo) ? value.__tmp8.replyTo[1] : undefined,
"a3comment_time": value.__tmp8.time,
"a4user_id": value.__tmp9.userId,
"a4profile_name": (isObject(value.__tmp9.profile) && (! Array.isArray(value.__tmp9.profile))) ? value.__tmp9.profile.name : undefined,
"a4age": (isObject(value.__tmp9.profile) && (! Array.isArray(value.__tmp9.profile))) ? value.__tmp9.profile.age : undefined,
"a4title": (isObject(value.__tmp9.profile) && (! Array.isArray(value.__tmp9.profile))) ? value.__tmp9.profile.title : undefined,
"a4comment_id": value.__tmp8.id,
"a4comment_text": value.__tmp8.text,
"a4comment_reply_to_profile": Array.isArray(value.__tmp8.replyTo) ? value.__tmp8.replyTo[0] : undefined,
"a4comment_reply_to_comment": Array.isArray(value.__tmp8.replyTo) ? value.__tmp8.replyTo[1] : undefined,
"a4comment_time": value.__tmp8.time
}]
})(
this._id,
this))
},
function (key, values) { return values[0] },
{ "out": { "replace": "tmp.gen_0", "db": "quasar" } });
db.tmp.gen_1.drop();
db.tmp.gen_0.aggregate(
[
{
"$project": {
"user_id": "$value.user_id",
"profile_name": "$value.profile_name",
"age": "$value.age",
"title": "$value.title",
"comment_id": "$value.comment_id",
"comment_text": "$value.comment_text",
"comment_reply_to_profile": "$value.comment_reply_to_profile",
"comment_reply_to_comment": "$value.comment_reply_to_comment",
"comment_time": "$value.comment_time",
"a1user_id": "$value.a1user_id",
"a1profile_name": "$value.a1profile_name",
"a1age": "$value.a1age",
"a1title": "$value.a1title",
"a1comment_id": "$value.a1comment_id",
"a1comment_text": "$value.a1comment_text",
"a1comment_reply_to_profile": "$value.a1comment_reply_to_profile",
"a1comment_reply_to_comment": "$value.a1comment_reply_to_comment",
"a1comment_time": "$value.a1comment_time",
"a2user_id": "$value.a2user_id",
"a2profile_name": "$value.a2profile_name",
"a2age": "$value.a2age",
"a2title": "$value.a2title",
"a2comment_id": "$value.a2comment_id",
"a2comment_text": "$value.a2comment_text",
"a2comment_reply_to_profile": "$value.a2comment_reply_to_profile",
"a2comment_reply_to_comment": "$value.a2comment_reply_to_comment",
"a2comment_time": "$value.a2comment_time",
"a3user_id": "$value.a3user_id",
"a3profile_name": "$value.a3profile_name",
"a3age": "$value.a3age",
"a3title": "$value.a3title",
"a3comment_id": "$value.a3comment_id",
"a3comment_text": "$value.a3comment_text",
"a3comment_reply_to_profile": "$value.a3comment_reply_to_profile",
"a3comment_reply_to_comment": "$value.a3comment_reply_to_comment",
"a3comment_time": "$value.a3comment_time",
"a4user_id": "$value.a4user_id",
"a4profile_name": "$value.a4profile_name",
"a4age": "$value.a4age",
"a4title": "$value.a4title",
"a4comment_id": "$value.a4comment_id",
"a4comment_text": "$value.a4comment_text",
"a4comment_reply_to_profile": "$value.a4comment_reply_to_profile",
"a4comment_reply_to_comment": "$value.a4comment_reply_to_comment",
"a4comment_time": "$value.a4comment_time"
}
}],
{ "allowDiskUse": true });
Query time: 0.1s
user_id | profile_name | age | title | comment_id | comment_text | comment_reply_to_profile | comment_reply_to_comment | comment_time | a1user_id | a1profile_name | a1age | a1title | a1comment_id | a1comment_text | a1comment_reply_to_profile | a1comment_reply_to_comment | a1comment_time | a2user_id | a2profile_name | a2age | a2title | a2comment_id | a2comment_text | a2comment_reply_to_profile | a2comment_reply_to_comment | a2comment_time | a3user_id | a3profile_name | a3age | a3title | a3comment_id | a3comment_text | a3comment_reply_to_profile | a3comment_reply_to_comment | a3comment_time | a4user_id | a4profile_name | a4age | a4title | a4comment_id | a4comment_text | a4comment_reply_to_profile | a4comment_reply_to_comment | a4comment_time |
------------|--------------|-------|-------|------------|--------------|--------------------------|--------------------------|--------------|------------|----------------|-------|---------|--------------|----------------|----------------------------|----------------------------|----------------|------------|----------------|-------|---------|--------------|----------------|----------------------------|----------------------------|----------------|------------|----------------|-------|---------|--------------|----------------|----------------------------|----------------------------|----------------|------------|----------------|-------|---------|--------------|----------------|----------------------------|----------------------------|----------------|
8927524.0 | Mary Jane | 29.0 | Dr | F2372BAC | I concur. | 9817361.0 | F8ACD164F | 2015-02-03 | 8927524.0 | Mary Jane | 29.0 | Dr | F2372BAC | I concur. | 9817361.0 | F8ACD164F | 2015-02-03 | 8927524.0 | Mary Jane | 29.0 | Dr | F2372BAC | I concur. | 9817361.0 | F8ACD164F | 2015-02-03 | 8927524.0 | Mary Jane | 29.0 | Dr | F2372BAC | I concur. | 9817361.0 | F8ACD164F | 2015-02-03 | 8927524.0 | Mary Jane | 29.0 | Dr | F2372BAC | I concur. | 9817361.0 | F8ACD164F | 2015-02-03 |
8927524.0 | Mary Jane | 29.0 | Dr | GH732AFC | NA | 9654726.0 | A44124F | 2015-03-01 | 8927524.0 | Mary Jane | 29.0 | Dr | GH732AFC | NA | 9654726.0 | A44124F | 2015-03-01 | 8927524.0 | Mary Jane | 29.0 | Dr | GH732AFC | NA | 9654726.0 | A44124F | 2015-03-01 | 8927524.0 | Mary Jane | 29.0 | Dr | GH732AFC | NA | 9654726.0 | A44124F | 2015-03-01 | 8927524.0 | Mary Jane | 29.0 | Dr | GH732AFC | NA | 9654726.0 | A44124F | 2015-03-01 |
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment