Nested fields with Mongo FDW

From: Michael Contraveos <mcontraveos(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Nested fields with Mongo FDW
Date: 2015-05-15 15:51:32
Message-ID: CA+mwVM9R-1vN6hUxOjCRV7-ZBquRBGBPihU9=J=OUs0wCAYoEQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello,

I recently installed a PostgreSQL server to this spec:

server v9.3.6
EnterpriseDB mongo_fdw vREL-4_0_0
libbson v1.1.5
mongo C driver v1.1.5

and Mongo is at 2.7.1. Mapping fields in Mongo documents, including _id,
has been successful, with the exception of nested fields. Assuming my Mongo
document looks like this:

{
"_id" : ObjectId("5550ebf18cf0280b5fec373a"),
"message": {
"order_id": 15
}
}

I would think this table should do:

CREATE FOREIGN TABLE ats.messages (
_id NAME,
"message.order_id" INT
)
SERVER mongo_server OPTIONS (database 'db', collection 'test_collection')

While that doesn't raise any errors, any SELECT against the table shows
"message.order_id" as empty. Are nested fields supported in this version of
mongo_fdw? If so, what's the proper way to map nested fields to table
columns?

thank you,
MC

Browse pgsql-general by date

  From Date Subject
Next Message Rob Sargent 2015-05-15 16:17:33 Re: R: Index on integer or on string field
Previous Message Daniel Begin 2015-05-15 15:35:47 Re: Restarting DB after moving to another drive