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.
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/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.