[ 
https://issues.apache.org/jira/browse/CALCITE-194?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15492718#comment-15492718
 ] 

Jordan Halterman commented on CALCITE-194:
------------------------------------------

This can actually be done with {{$arrayElemAt}}:
https://docs.mongodb.com/manual/reference/operator/aggregation/arrayElemAt/#exp._S_arrayElemAt

It would look something like {{db.zips.aggregate({$project: {lng: 
{$arrayElemAt: ["$loc", 0]}}})}}

> Array items in MongoDB adapter
> ------------------------------
>
>                 Key: CALCITE-194
>                 URL: https://issues.apache.org/jira/browse/CALCITE-194
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: GitHub Import
>              Labels: github-import
>
> When MongoDB issue <a 
> href="https://jira.mongodb.org/browse/SERVER-4589";>SERVER-4589</a>, 
> "aggregation: need an array indexing operator" is fixed, we will be able to 
> implement
> ```sql
> SELECT loc[0] AS longitude, loc[1] AS latitude FROM zips
> ```
> in the MongoDB adapter. Meantime, look for `Bug.OPTIQnnn_FIXED` in the code.
> ---------------- Imported from GitHub ----------------
> Url: https://github.com/julianhyde/optiq/issues/194
> Created by: [julianhyde|https://github.com/julianhyde]
> Labels: bug, 
> Created at: Wed Mar 19 00:03:01 CET 2014
> State: open



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to