[SERVER-16756] TTL at fields level Created: 07/Jan/15  Updated: 15/Jan/15  Resolved: 15/Jan/15

Status: Closed
Project: Core Server
Component/s: Storage
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: guipulsar Assignee: Unassigned
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:

 Description   

TTL feature for field , auto deleting (or update) a field after x seconde , use case :

Manage easely online mebers in your collection.
A members is connected , we put a flag online , at the application level each X seconde we reput the flag to maintain the online statut .
When a search for members online comes, profiles no more online is easely identified because " TTL for fields feature deleted (or update) the online flag.

Actually to doing this, i need a cron task to delete (or update) the online flag with the help of others 'flagtime' etc , creating some overhead..



 Comments   
Comment by Ramon Fernandez Marina [ 15/Jan/15 ]

pulsar, as per my last comment I'm resolving this ticket. For further discussion on alternatives please follow up on mongbdb-user. You may also want to take a look at SERVER-124, which is opened to implement triggers. Feel free to vote for that ticket if you're interested.

Regards,
Ramón.

Comment by guipulsar [ 08/Jan/15 ]

by storing a timestamp in the "online" flag, and then searching for timestamps greater than "now() - expiration_date" is a good thing but there are may other cases were its not so easy..

Actually the standar TTL allow auto delete at document level , i found interesting to have this option at field level too, but perhaps this is not , i am no more sure.. :/ I guess i am talking about a ..trigger in fact

Comment by Ramon Fernandez Marina [ 07/Jan/15 ]

pulsar, if I understand the usage case correctly I think there are ways to accomplish this already:

  • by storing a timestamp in the "online" flag, and then searching for timestamps greater than "now() - expiration_date"
  • by using a standard TTL collection when one can insert/update a document containing users' online information

I don't think the feature proposed in this ticket aligns well with MongoDB's data model and architecture, but if you think the existing features are not sufficient to implement a solution feel free to add further details on your use case and explain what TTL collections are lacking.

If you want to discuss possible solutions for your specific application needs please post on the mongodb-user group or Stack Overflow with the mongodb tag, where your question will reach a larger audience

Generated at Thu Feb 08 03:42:10 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.