Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
MySQLに相当するものを探しています
SELECT * FROM table WHERE field1 LIKE '%somestring%' AND field2 LIKE '%anotherstring%'
私はいくつかのことを試しました
'field1' => '/somestring/i', 'field2' => '/anotherstring/i'
結果が返らないか、2つのフィールドのいずれかに基づくデータのみが返されます。これはMongoDBでは不可能ですか?
db.collection.find({field1: {$regex: /somestring/i}, field2: {$regex: /anotherstring/i}});
でphp行う必要がありますMongoRegex。
php
MongoRegex
array(field1 => new MongoRegex("/somestring/i"), field2 => new MongoRegex("/anotherstring/i"))