mongodb有个地方看不懂
淡淡烟草味
淡淡烟草味 2017-04-27 09:02:26
0
2
548
$collection = $this->_getCollection("counters");

$counter = $collection->findAndModify(
        array(
            "_id" => $name
        ),
        array(
            '$inc' => array(
                "seq" => 1
            )
        )
    );
    
    return $counter["seq"];
    
    
    

返回的是什么?
__________________________________________后来补充______________________________________________

逻辑是
在counters中查处某个的表名例如(aaa_aaa)的seq
然后将这个表(aaa_aaa)的seq存入该表(aaa_aaa)中的id值

淡淡烟草味
淡淡烟草味

reply all(2)
巴扎黑

$inc In mongo, it increases by 1, so the result increases by 1 every time

伊谢尔伦

Seq+1 of the document whose "_id" attribute is $name in the counters collection

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template