Skip to content

How to insert a new row when using (__doc json) without failing on first column of MongoDB's foreign table must be "_id"? #184

Description

@marmor

Hi,

mongo_fdw advises to use "(__doc json)" where the exact structure of the collection's documents is unknown and/or dynamic.
And it's even working great for SELECT, DELETE and even UPDATE.
But then, when trying to INSERT a new row, the following error message is thrown:
ERROR: first column of MongoDB's foreign table must be "_id"
Of course, it's impossible to insert _id before __doc, because the "column relation does not exist".
Defining the columns as (_id name, __doc json) doesn't help either, because _id should be the first column of __doc, inside __doc
(otherwise, if there are more than one column, the command will fail because there are more values than columns).

Do I miss anything?
Or is it really impossible to INSERT rows into a (__doc json) foreign table?

Thanks!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions