Android: _id starting with prefix

10 views
Skip to first unread message

Jan Muller

unread,
Jan 21, 2015, 4:53:24 AM1/21/15
to mobile-c...@googlegroups.com
Hi, I am just thinking about generating _id like a prefix + uuid ..., where prefix is a model type. I think it could be better, because i would have sorted documents by model type in main index so i can query on all_docs view. Are there any cons with this approach? 

Jens Alfke

unread,
Jan 21, 2015, 4:40:33 PM1/21/15
to mobile-c...@googlegroups.com

> On Jan 21, 2015, at 1:53 AM, Jan Muller <mull...@gmail.com> wrote:
>
> Hi, I am just thinking about generating _id like a prefix + uuid ..., where prefix is a model type. I think it could be better, because i would have sorted documents by model type in main index so i can query on all_docs view. Are there any cons with this approach?

Sure, there’s no problem with generating your own doc IDs. All you do is call documentWithID instead of newDocument.

—Jens
Reply all
Reply to author
Forward
0 new messages