第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

根據(jù)List里面的值,查詢(xún)模糊查詢(xún)mongodb,最好用springdata mongodb

根據(jù)List里面的值,查詢(xún)模糊查詢(xún)mongodb,最好用springdata mongodb

HUWWW 2019-01-16 22:36:46
現(xiàn)在條件是一個(gè)List,如 type["sh","th"] //不是數(shù)據(jù)庫(kù)type里面的全值,只有一個(gè)前綴 根據(jù)這個(gè)查詢(xún)下面數(shù)據(jù)庫(kù),type里面有sh和th為前綴的,整個(gè)document 結(jié)果應(yīng)該是1,2,4條record(document)都應(yīng)該被查出來(lái) 怎么實(shí)現(xiàn),最好用springdata mongdb,其它java方式也行 比如數(shù)據(jù)庫(kù)有3條record如下: { "_id": "5bcfe3367f0xxxxx02", "type": [ "sh-adidas", "th-NB" ], "status": "active", "lastUpdateDate": "2018-10-25T17:27:41+08:00" } { "_id": "5bcfe3367f0xxxxx02", "type": [ "bj-nike", "sh-adidas" ], "status": "active", "lastUpdateDate": "2018-10-25T17:27:41+08:00" } { "_id": "5bcfe3367f0xxxxx02", "type": [ "bj-nike" ], "status": "active", "lastUpdateDate": "2018-10-25T17:27:41+08:00" } { "_id": "5bcfe3367f0xxxxx02", "type": [ "bj-nike", "sh-adidas", "th-NB", "th-vans" ], "status": "active", "lastUpdateDate": "2018-10-25T17:27:41+08:00" }
查看完整描述

1 回答

?
慕后森

TA貢獻(xiàn)1802條經(jīng)驗(yàn) 獲得超5個(gè)贊

mongoSQL:

db.inventory.find({"$or":[{type:{"$regex":"sh"}},{type:{"$regex":"bj"}}]});

SpringData Mongo:

Query qury = query.orOperator(Criteria.where("type").regex("sh"),Criteria.where("type").regex("bj"));
mongoTemplate.find(qury,entityClass);?
查看完整回答
反對(duì) 回復(fù) 2019-02-12
  • 1 回答
  • 0 關(guān)注
  • 719 瀏覽
慕課專(zhuān)欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢(xún)優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)