Passing multiple Unique IDs (28 digits string values) as an array string at one time (not individual) to MongoDB and get Names as an array list

36 views
Skip to first unread message

SURESH-AP

unread,
Jan 26, 2012, 12:48:17 PM1/26/12
to mongodb-user
Hi,

We have Multiple Unique IDs (which has 28 digit as string/varchar
values) and need to pass the same as an array or other way at one time
(not individual value) to MongoDB and get the resultset as an array
list.

Basically we have master DB as MySQL and it is sync up with MongoDB
for each record, which is entered in master DB and master DB is
expecting to be 1.2 billion records and still it will go further.

Is there any way to pass the multiple IDs as an array list at one time
(not individual) and retrieve the values as an array list? We need to
do this in Java.

Basically, we need to use the MongoDB because, we need to check and
retrieve more than 1million records per day and hence we can reduce
the lot of processing time for fetching the data direct from Master DB
(MySQL) and reduce the number of hits to Msater DB. And also expecting
to pass the values at a time as array list might be 100 IDs at one
time. I hope there is no limit to pass the IDs?


So can anyone help us on how can we acieve this requirement on high
priority?

Regards,
Suresh

Scott Hernandez

unread,
Jan 26, 2012, 1:51:57 PM1/26/12
to mongod...@googlegroups.com
You can use $in to pass an array of matching items (or'd together) as
explained here:
http://www.mongodb.org/display/DOCS/Advanced%20Queries#AdvancedQueries-%24in

Is that what you want?

> --
> You received this message because you are subscribed to the Google Groups "mongodb-user" group.
> To post to this group, send email to mongod...@googlegroups.com.
> To unsubscribe from this group, send email to mongodb-user...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.
>

SURESH-AP

unread,
Jan 30, 2012, 2:09:12 AM1/30/12
to mongodb-user
Thank you very much Scott for your quick response and quick solution
and we have tried the same and it is working fine as per our
requirement.

Thanks Once again,
Suresh-AP

On Jan 26, 11:51 pm, Scott Hernandez <scotthernan...@gmail.com> wrote:
> You can use $in to pass an array of matching items (or'd together) as
> explained here:http://www.mongodb.org/display/DOCS/Advanced%20Queries#AdvancedQuerie...
> > For more options, visit this group athttp://groups.google.com/group/mongodb-user?hl=en.- Hide quoted text -
>
> - Show quoted text -
Reply all
Reply to author
Forward
0 new messages