PHP 怎么執(zhí)行mongodb 的 $in 和$size查詢?
假設(shè)有個這樣的集合
{ "_id" : ObjectId("5022518d09248743250688e0"), "name" : "big fruit", "fruits" : [ "apple", "pear", "orange" ] } ,{ "_id" : ObjectId("502251a309248743250688e1"), "name" : "good fruit", "fruits" : [ "banana", "pear", "orange" ] }, { "_id" : ObjectId("502251c109248743250688e2"), "name" : "good fruit", "fruits" : [ "banana", "apple", "tomato" ] }
假設(shè)有這樣的集合
RT 者兩句代碼用PHP怎么寫
db.coll.find({_id:{$in[ ObjectId("502251a3092487432506<愛尬聊_百科詞條>88e1"), ObjectId("502251c109248743250688e2")]}})
查詢長度為三的數(shù)組
db.coll.find({fruits:{$size:0}})
用PHP的話要怎么實現(xiàn)