Link to home
Start Free TrialLog in
Avatar of bmanmike39
bmanmike39

asked on

How do i write the query to select records 100 - 199 in a Mongo db.

How would i write the query in Mongo db to select records 100 through 199 only.

Thank you.
Avatar of Mike Eghtebas
Mike Eghtebas
Flag of United States of America image

What are your table name and column names. Based on which column you want to sort (after which you want 100 through 199).

Without order by a column, there is no guarantied  row order.
Avatar of bmanmike39
bmanmike39

ASKER

Collection Name is Members

Column _id
memNumber
FName
LName
ClassNumber
email
This code works in SQL Server. Most likely it will work in your database as well because all of them follow standard SLQ.
SELECT Column _id
          , memNumber
          , FName
          , LName
          , ClassNumber
          , email
FROM Members 
ORDER BY Column _id OFFSET 100 ROWS FETCH NEXT 99 ROWS ONLY;

Open in new window


Give this a try to see if it works.

Mike
not it didn't work
ASKER CERTIFIED SOLUTION
Avatar of IrogSinta
IrogSinta
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks! that was it.