Re: Wide to long transformation in aggregation

From: Kevin Adistambha <kevinadi@xxxxxxxxxxx>
To: mongodb-user <mongodb-user@xxxxxxxxxxxxxxxx>
Date: Thu, 28 Apr 2016 22:30:51 -0700 (PDT)
Why ads?


Hi Boyd

asset, start_date, end_date, ship_date

“A”, 2015-01-01, 2015-02-01, 2015-03-01

“B”, 2015-02-01, 2015-02-15, 2015-03-01

Could you provide an actual document that you’re trying to aggregate? The 
example you gave looks like an SQL table and does not accurately show the 
datatype associated with it.

For example, the date aggregation operator 
<https://docs.mongodb.org/manual/reference/operator/aggregation-date/> does 
not work with string types. It requires an ISODate 
<https://docs.mongodb.org/manual/core/shell-types/#date> type to be able to 
function.

_id : {
year: 2015,
month: 1
},
start:1,
end: 0,
ship: 0
},

Could you elaborate on the meanings of the field names and values, e.g. 
what does “start”, “end”, and “ship” signifies? How are they connected to 
the example you give (which only has “A” and “B”)

Best regards,
Kevin


-- 
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.

For other MongoDB technical support options, see: https://docs.mongodb.org/manual/support/
--- 
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user+unsubscribe@xxxxxxxxxxxxxxxx.
To post to this group, send email to mongodb-user@xxxxxxxxxxxxxxxx.
Visit this group at https://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/1132de7d-a989-46df-8c18-0021435805cd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Why ads?