0

Would be nice if someone knows some examples for my "Query".

If have an Collection with Prices and Timestamps, i have to query for the records withe the newest timestamp "only".

I could query for all records sorted by timestamp and do an second query with the newest timestamp from the result, but i suppose this is not the best way (500.000 records). Does someone knows an good way to do this with mongoDB and PHP5?

1 Answer 1

2

If you are using a standard, auto-generated default '_id' primary field, that is timestamp based. Getting a single (limit(1)) in descending order will be the most recent document.

Beyond that, depends on the schema you are using.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.