Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

child id fails because ["id" is required] #283

Open
ju-Skinner opened this issue May 5, 2017 · 2 comments
Open

child id fails because ["id" is required] #283

ju-Skinner opened this issue May 5, 2017 · 2 comments
Labels

Comments

@ju-Skinner
Copy link

Yes, this sounds pretty trivial, but I am loading data from a large dataset via mongoimport. It is creating the internal _id using ObjectId. What I have seemed to discover that doing the data load this way, it doesn't process the data the same way in which it would be done via a "Post" passing individual records.

I am currently using jsonapi-store-mongodb. There is an issue with that handler when using ObjectId's, but this PR solves that problem, you can see in the screenshot below.
image

this is a snippet from a simple search, that would correlate with the db.collection.find({})
image

Screenshot of Db result:
image

Screen shot of my result page.
image

But once I started to debug the server, it was clear why the results weren't being rendered.

My question is, how can this be solved when bulk inserting data via console?

@pmcnr-hx
Copy link
Contributor

Apologies for the late reply @ju-Skinner. I'm going to merge the jsonapi-store-mongodb PR and then we can figure out if your issue is with the data store or generic to the jsonapi-server.

@pmcnr-hx pmcnr-hx added the bug label May 21, 2017
@toddiuszho
Copy link

With MongoDB 3.6, was able to use the new UUID() in my mongo shell scripts like so:

db = connect("localhost:27017/test");

function apiId() {
    return UUID().toString().split('"')[1];
}

db.user.insertMany([
    { id: apiId(), type: 'user', name: "Terry Trundle", age: 45, status: "active" },
    { id: apiId(), type: 'user', name: "Tammy Tisdale", age: 25, status: "active" },
    { id: apiId(), type: 'user', name: "Theodore Tanner", age: 35, status: "disabled" }
]);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants