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

DBRef objects link to a 404 page #71

Closed
nicktacular opened this issue Jan 9, 2013 · 6 comments
Closed

DBRef objects link to a 404 page #71

nicktacular opened this issue Jan 9, 2013 · 6 comments
Labels
bug

Comments

@nicktacular
Copy link

@nicktacular nicktacular commented Jan 9, 2013

When displaying DBRef objects, it appears that not all links are working correctly. Suppose you have this in an object:

ParentID: {
    $ref: "page",
    $id: 28
}

Clicking on $ref: "page" takes me to the page collection if I'm not already there and or in some query. Everything is good here; just as expected.

However, clicking on $id: 28 takes me to a 404 page:
/servers/localhost/databases/mydb/collections/page/documents/28

Expected: See the document with _id:28 in the page collection.
Actual: 404 page (/servers/localhost/databases/mydb/collections/page/documents/28)

Genghis version: Version 2.1.6
PHP: 5.3.3
Mongo: 2.2.2

@bobthecow
Copy link
Owner

@bobthecow bobthecow commented Jan 10, 2013

I'm not sure I follow what's happening here... If you navigate directly to that document (rather than clicking through the dbref) what url do you hit?

@nicktacular
Copy link
Author

@nicktacular nicktacular commented Jan 10, 2013

If I navigate directly to a document (say {_id:28}) then the URL looks like this:
/servers/localhost/databases/mydb/collections/page/documents/~Mjg%3D

I did this by clicking on the collection, scrolling down to the object I wanted to see, and clicking on the title 28 which took me to the URL above.

However, if I do the same thing but utilize a DBRef to get to the same object by clicking on $id: 28 in a DBRef, it tries taking me to this URL (which is a 404):
/servers/localhost/databases/mydb/collections/page/documents/28

The difference appears to be ~Mjg%3D versus 28 in the URL. The latter making more sense, but obviously that's just an implementation detail.

Does this help?

@bobthecow
Copy link
Owner

@bobthecow bobthecow commented Jan 10, 2013

Yep, that helps.

It's getting confused because the _id isn't an ObjectId... the ~... encoded url params are used for all non-ObjectId id types. Apparently I didn't add logic for those to the DBRef links :)

@bobthecow
Copy link
Owner

@bobthecow bobthecow commented Jan 18, 2013

Thanks for helping me track this down. It has been fixed in develop. Do you mind giving that version a shot and making sure it works as you expect?

@bobthecow bobthecow closed this Jan 18, 2013
bobthecow added a commit that referenced this issue Feb 11, 2013
Fixes #71
@nicktacular
Copy link
Author

@nicktacular nicktacular commented Feb 11, 2013

It's looking good on my end. Thanks very much!

@bobthecow
Copy link
Owner

@bobthecow bobthecow commented Feb 11, 2013

Great, thank you!

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

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.