如果我有这个 - tadd 是Address表:
CONCAT(tadd.street_number, ' ',
tadd.street_name,', ',
tadd.apt_number,', ',
tadd.city,', ',
tadd.postal_code,', ',
tadd.country) AS 'Address'
Run Code Online (Sandbox Code Playgroud)
如果 apt_number 不存在,有没有办法排除它?
我在想:
WHERE tadd.apt_number IS NOT NULL
Run Code Online (Sandbox Code Playgroud)
但它只会返回那些带有apt_number, 的行,即使某些东西有效,我该如何处理那个额外的逗号。
如果是重复的,请在评论中发布链接。
我可以将 MongoDB 启动为$sudo service mongod start. 当我开始时没有sudo它给我这个错误:
/etc/init.d/mongod: line 58: ulimit: open files: cannot modify limit: Operation not permitted
/etc/init.d/mongod: line 60: ulimit: max user processes: cannot modify limit: Operation not permitted
Starting mongod: runuser: may not be used by non-root users
Run Code Online (Sandbox Code Playgroud)
1)现在,我已将所有权更改为我能找到的所有 mongo 目录上的非 root 用户,即/var/lib/mongo,,,,var/log/mongodbdata/dbvar/run/mongodb
$sudo chown -R nonRootUser:nonRootUser [directory]
Run Code Online (Sandbox Code Playgroud)
2)我删除了mongod.lock文件
--repair3)我也跑过
它仍然给我同样的错误。
我也尝试过
$mongod --fork --logpath /var/log/mongodb.log
about to fork child process, waiting until server …Run Code Online (Sandbox Code Playgroud)