0

I want to delete all mongodb collection before created date today with cron. So i want MongoDB collection creation date. Can it possible to get data from database in php .

However i have below option to get date manually.

I can create new collection that will contain collection name and create date.

1 Answer 1

1

From object id you can get the date, so make use of it and delete accordingly.

ObjectId is a 12-byte BSON type, constructed using:

a 4-byte value representing the seconds since the Unix epoch,
a 3-byte machine identifier,
a 2-byte process id, and
a 3-byte counter, starting with a random value.

Please check thi link : http://docs.mongodb.org/manual/reference/object-id/

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.