小编Ris*_*abh的帖子

mongo db查询大于等于的数组值

我有一个类似的架构

{
   'user_id' : 1,
   'marks' : [10, 40]
}
Run Code Online (Sandbox Code Playgroud)

我想找到至少一次得分在20到30之间的用户数量.

我尝试了以下查询

db.users.count({
   'marks' : {$gte: '20', $lt: '30'}
})
Run Code Online (Sandbox Code Playgroud)

但这也包括标记超过30的那些......

arrays mongodb

13
推荐指数
3
解决办法
2万
查看次数

Peewee加入后获得专栏

我无法读取已加入的另一个表的列.它抛出AttributeError

class Component(Model):
  id = IntegerField(primary_key=True)
  title = CharField()

class GroupComponentMap(Model):
  group = ForeignKeyField(Component, related_name='group_fk')
  service = ForeignKeyField(Component, related_name='service_fk')
Run Code Online (Sandbox Code Playgroud)

现在查询是

comp = (Component
        .select(Component, GroupComponent.group.alias('group_id'))
        .join(GroupComponent, on=(Component.id == GroupComponent.group))
       )

for row in comp:
  print row.group_id
Run Code Online (Sandbox Code Playgroud)

现在我收到一个错误 AttributeError: 'Component' object has no attribute 'group_id'

python mysql peewee

7
推荐指数
1
解决办法
889
查看次数

在RPM系统上使用Lua构建nginx

我想用Lua第三方模块构建nginx.该模块需要Lua库.Lua 5.1安装在我的服务器上.但是当我使用nginx lua模块的路径运行./compile时.抛出错误:

checking for Lua library ... not found 
checking for Lua library in /usr/local/ ... not found 
checking for Lua library in /usr/pkg/ ... not found 
checking for Lua library in /opt/local/ ... not found 
checking for Lua library in /usr/local/../lua51/ ... not found 
checking for Lua library in /usr/ ... not found  
./configure: error: ngx_http_lua_module requires the Lua library.
Run Code Online (Sandbox Code Playgroud)

我尝试通过导出给路径,LUA_LIB=/usr/local/lib/但也没有用.

任何帮助,将不胜感激.

lua rpm nginx

0
推荐指数
1
解决办法
4154
查看次数

标签 统计

arrays ×1

lua ×1

mongodb ×1

mysql ×1

nginx ×1

peewee ×1

python ×1

rpm ×1