Answer the question
In order to leave comments, you need to log in
Is there adequate support for auto increment values in mongodb?
Yuzal such a thing:
$ret = static::findAndModify(['_id' => $name], ['$inc' => ['seq' => 1]], ['new' => true, 'upsert' => true]);
if(!isset($ret->seq))
{
return 1;
}
return ++$ret->seq;
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question