Skip to content

Is there any concern that object id references are made by string and not ObjectId? #134

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

Closed
jmshelby opened this issue Feb 20, 2014 · 1 comment
Labels

Comments

@jmshelby
Copy link

I noticed, that when relationships are used, you're setting the referential object id as as string rather than and ObjectId type. Is there any concern with this route, as far as speed and optimization?

The link Here seems to imply that references should be stored as this ObjectId type, since it takes up less space and is faster to query by.

And here is what I see in my database, showing that the type of the reference 'player_id' is stored as a string rather than an ObjectId:

> db.player_pool_activity.find().pretty();
{
    "_id" : ObjectId("530596439e8ff6791a8b4567"),
    "player_id" : "530591529e8ff64f198b456b",
    "updated_at" : ISODate("2014-02-20T05:44:35.942Z"),
    "created_at" : ISODate("2014-02-20T05:44:35.942Z")
}
@jenssegers
Copy link
Contributor

I tried using ObjectId's but it turned out to be a pain in the ass for Eloquent and the relations.

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

2 participants