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.
bmanmike39Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mike EghtebasDatabase and Application DeveloperCommented:
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.
bmanmike39Author Commented:
Collection Name is Members

Column _id
memNumber
FName
LName
ClassNumber
email
Mike EghtebasDatabase and Application DeveloperCommented:
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
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

bmanmike39Author Commented:
not it didn't work
IrogSintaCommented:
I'm not a Mongo user but after a quick bit of research, I found that Mongo is a NoSQL database.  I also came across a tutorial that was very helpful.  Try this out and see if it gives you what you want:
db.Members.find().limit(100).skip(99);

Open in new window

or the following for a different view:
db.Members.find().limit(100).skip(99).pretty();

Open in new window


In case you're interested, here's a link to the Mongo tutorial:
Mongo Tutorial

Ron

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
bmanmike39Author Commented:
Thanks! that was it.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Query Syntax

From novice to tech pro — start learning today.