Facebook user_id as MongoDB BSON ObjectId?

Posted by MattDiPasquale on Stack Overflow See other posts from Stack Overflow or by MattDiPasquale
Published on 2011-01-09T00:45:20Z Indexed on 2011/01/09 0:54 UTC
Read the original article Hit count: 220

Filed under:
|
|
|

I'm rebuilding Lovers on Facebook with Sinatra & Redis. I like Redis because it doesn't have the long (12-byte) BSON ObjectIds and I am storing sets of Facebook user_ids for each user. The sets are requests_sent, requests_received, & relationships, and they all contain Facebook user ids.

I'm thinking of switching to MongoDB because I want to use it's geospatial indexing. If I do, I'd want to use the FB user ids as the _id field because I want the sets to be small and I want the JSON responses to be small. But, is the BSON ObjectId better (more efficient for MongoDB) to use than just an integer (fb user_id)?

© Stack Overflow or respective owner

Related posts about facebook

Related posts about indexing