关于java中使用mongo中的concat拼接字符串问题
- mongo查询语句
- db.ABCollection.aggragate([
{KaTeX parse error: Expected 'EOF', got '}' at position 16: match:{name:""}}̲//查询条件 {project:{
name:1,
sexName:{ c o n c a t : [ ′ concat:[' concat:[′sex’,‘KaTeX parse error: Expected 'EOF', got '}' at position 7: mame']}̲}}//结果展示字段。sex和…cond:{if:{KaTeX parse error: Expected '}', got 'EOF' at end of input: eq:{'sex’,’"+""+"’}},then:'KaTeX parse error: Expected '}', got 'EOF' at end of input: sex',else:{concat:{‘ s e x ′ , ′ sex',' sex′,′name’}}}}
).as(‘sexName’)
相当于做了个判断,sex为空就是sex,不为空就是sex+name。
有知道怎么直接用concat的麻烦告诉我下