3

I 'v posted my question some days ago in the official arangodb website , but no lucks no people answer it . so i come to here . below is my question:

just want to know if use arangoDb as a php sessionHandler , how can i delete the session data that expired !

if use the mogodb or mysql to store the session data, we can use such statement to remove the expired data: db.session.remove( { expire: { $gt :} } ) or the sql : delete from tbl_session where expire<:expire

I just want to know how this can be implemented in arangodb . :)

2

2 Answers 2

3

We do not yet support modifying AQLs. So you need to execute a bit of code:

var q = db._query("FOR s in session filter s.expire < 1393231738788 return s");
while (q.hasNext()) {
  db.session.remove(q.next());
}
Sign up to request clarification or add additional context in comments.

Comments

1

mchacki's answer is correct till ArangoDB 2.2.

Since 2.2 we do have modified queries so the new query for our Database would look like this:

FOR s IN sessions
  FILTER s.expire < DATE_NOW()-86400000
  REMOVE s IN sessions

With this example one day old sessions would be deleted.

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.