Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
MongoDB best practices docs: MongoDB-record optimizing ObjectIDs
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
alexmnyc  
View profile  
 More options Oct 8 2012, 4:48 pm
From: alexmnyc <a.mikhai...@gmail.com>
Date: Mon, 8 Oct 2012 13:48:35 -0700 (PDT)
Local: Mon, Oct 8 2012 4:48 pm
Subject: MongoDB best practices docs: MongoDB-record optimizing ObjectIDs

Hi guys,

I looked into mongodb-record framework and was not able to find an
implementation of the ObjectIdField which would use base64 encoded approach
described in the Best Practices docs from MongoDB which is related to
"Store Binary GUIDs as BinData, rather than as hex encoded strings"

http://www.mongodb.org/display/DOCS/Optimizing+Object+IDs

What is the recommended approach in Lift community to implement such an
optimization?

Thank you.

Alex


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tim Nelson  
View profile  
 More options Oct 9 2012, 5:59 am
From: Tim Nelson <tnell...@gmail.com>
Date: Tue, 9 Oct 2012 02:59:32 -0700 (PDT)
Local: Tues, Oct 9 2012 5:59 am
Subject: Re: MongoDB best practices docs: MongoDB-record optimizing ObjectIDs

Hi Alex,

These two things are not related.

"Store Binary GUIDs as BinData, rather than as hex encoded strings" This is
what ObjectIdField does.

The "base64 encoded approach" is for storing the id of "foreign keys" in an
embedded document, which will store them as Strings.

Tim


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
alexmnyc  
View profile  
 More options Oct 9 2012, 11:38 am
From: alexmnyc <a.mikhai...@gmail.com>
Date: Tue, 9 Oct 2012 08:38:31 -0700 (PDT)
Local: Tues, Oct 9 2012 11:38 am
Subject: Re: MongoDB best practices docs: MongoDB-record optimizing ObjectIDs

If I dig into the source of ObjectId.java from org.bson.types.ObjectId, I
see that there is an anticipation for the valid id to be a 24 character
hexadecimal represented string.
It looks like ObjectIdField has an implicit dependency on this convention
as well. For example,

*this is from package net.liftweb.mongodb.record.field.ObjectIdField:*

def setFromString(in: String): Box[ObjectId] =
    if (ObjectId.isValid(in))
      setBox(Full(new ObjectId(in)))
    else
      setBox(Failure("Invalid ObjectId string: "+in))

Which would mean that anything other than a 24 character long hex
represented string would not get Box'ed with a value.
Am I looking in the wrong place? I'm totally confused.

*This is from org.bson.types.ObjectId:*

public static boolean isValid( String s ){
        if ( s == null )
            return false;

        final int len = s.length();
        if ( len != 24 )
            return false;

        for ( int i=0; i<len; i++ ){
            char c = s.charAt( i );
            if ( c >= '0' && c <= '9' )
                continue;
            if ( c >= 'a' && c <= 'f' )
                continue;
            if ( c >= 'A' && c <= 'F' )
                continue;

            return false;
        }

        return true;
    }


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tim Nelson  
View profile  
 More options Oct 9 2012, 4:59 pm
From: Tim Nelson <tnell...@gmail.com>
Date: Tue, 9 Oct 2012 13:59:20 -0700 (PDT)
Local: Tues, Oct 9 2012 4:59 pm
Subject: Re: MongoDB best practices docs: MongoDB-record optimizing ObjectIDs

The isValid function checks whether or not a String representation of an
ObjectId is valid or not. It has nothing to do with how ObjectIds are
stored in the database.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »