HHVM MongoDb聚合似乎不起作用(HHVM MongoDb aggregation seems like it doesn't work)
我在hhvm上运行了一些php脚本我试图从MongoDB 3.2中的我的集合中获取数值字段的最大值这是我的聚合管道
$mongo = new \MongoDB\Driver\Manager(MONGODB_HOST); $myCollection = new \MongoDB\Collection($mongo, "mydb.mycollection"); $pipeline = [ [ '$group' => [ '_id' => 'group_field', 'slId' => ['$max' => '$saleId'] ], ] ]; $doc = $myCollection->aggregate($pipeline);
这个管道完全适用于mongo shell,但是从php $ doc包含我的集合中的所有文档,没有$ group应用于它们也许有人可以帮助我吗?
I have some php script running on hhvm I'm trying to get max value of numeric field from my collection in MongoDB 3.2 Here is my aggregation pipeline
$mongo = new \MongoDB\Driver\Manager(MONGODB_HOST); $myCollection = new \MongoDB\Collection($mongo, "mydb.mycollection"); $pipeline = [ [ '$group' => [ '_id' => 'group_field', 'slId' => ['$max' => '$saleId'] ], ] ]; $doc = $myCollection->aggregate($pipeline);
This pipeline perfectly works in mongo shell, but from php $doc contains all documents from my collection and no $group is applied to them Maybe someone can help me with that?
原文:https://stackoverflow.com/questions/35081494
最满意答案
使用sudo肯定会工作,你有一个例子在“ post-receive hook permission denied”无法创建文件“error ”,将git命令包装在脚本中。
将收到后更改为:
sudo sh /usr/local/sbin/prgetsimpleappscom
用visudo改变了sudoers
git ALL = (root) NOPASSWD: /bin/sh /usr/local/sbin/prgetsimpleappscom
另一种方法是作为
node
用户定期提取的cron作业,并且(如果有新的提交)拉入目标仓库。Using sudo would certainly work, you have one example at "post-receive hook permission denied “unable to create file” error", wrapping the git commands in a script.
Changed post-receive to:
sudo sh /usr/local/sbin/prgetsimpleappscom
Changed sudoers with visudo
git ALL = (root) NOPASSWD: /bin/sh /usr/local/sbin/prgetsimpleappscom
The other approach would be a cron job as
node
user regularly fetching and (if there are new commit) pulling in the destination repo.
相关问答
更多-
尝试使chmod对文件夹的内容而不是文件夹本身进行操作: chmod 755 -R /www/newrails/* 可能发生的事情是钩子正在运行的用户(通常是你用来进行Git访问的用户)有权写入文件夹,但不允许更改文件夹本身的模式。 Try making the chmod operate on the contents of the folder rather than the folder itself: chmod 755 -R /www/newrails/* What's probably ha ...
-
请检查您的文件是否具有可执行权限。 否则它不能执行。 像rwxr-xr-x应该就足够了。 您可以添加缺少的位 $ chmod +x /path/to/post-receive All of these answers are useful, but it turns out I needed the "bin" directory of git in my PATH variable. I had the "cmd" directory only. Added c:\my_path_to_git\git\ ...
-
如何添加。 ~git / .profile在你的post-receive钩子脚本的顶部(假设它是sh)。 但是,目前还不清楚你想要什么。 你要么: 1)只是推到外部现场,而不关心回购之间的共性。 在这种情况下,为什么需要来自其他地方的环境变量? 为什么不将最终位置放在post-receive钩子脚本本身? 2)您希望有一些外部变量来控制您将要推送大量不同存储库的根目录,如果您需要更改它,最好将该位置编码为单个变量。 如果是这样的话,你上面所做的事情是有道理的。 但是,你不一定需要首先在.profile中这样 ...
-
最后,我确实能够通过将目录(/ home / ubuntu / public_html / testing)的所有权更改为提交/运行挂钩的用户来解决它。 At last, I did able to solve it by changing the ownership of the directory(/home/ubuntu/public_html/testing) to the user who is commiting/running hook.
-
好的问题解决了。 我正在改变小组权限几个小时,它表现得非常奇怪。 后来我意识到你需要注销登录用户才能获得新的权限。 卫生署! :p Ok problem solved. I was changing group permissions for hours and it behaved very strange. Later on I realized that you need to log out en log in the user to get the new permissions working. ...
-
在接收(服务器端)端单独使用git似乎不可能:你需要自定义你的钩子以便允许这种情况(跳过)发生。 这与本地挂钩不同, 您可以跳过(对于其中一些挂钩) 。 请参阅“ 跳过后接收挂钩中已经处理过的Git修订的处理 ”中的钩子 (这是关于部分提交,但想法类似) It doesn't seem to be possible with git alone on the receiving (server -side) end: you need to customize your hook in order to a ...
-
2014年更新: Ciro Santilli 在评论和“ 使用GitLab的自定义后接收文件 ”中指出,现在(GitLab不再使用gitolite)是一种设置自定义挂钩的方法 (GitLab 7.5.0 +,2014年11月)。 选择一个需要自定义git钩子的项目。 在GitLab服务器上,导航到项目的存储库目录。 对于手动安装,路径通常是/home/git/repositories/
/ .git 。 对于Omnibus安装,路径通常是/var/opt/gitlab/git-d ... -
通过Gitolite和post-receive hook部署Node Apps(Deploying Node Apps via Gitolite and post-receive hook)[2022-03-19]
使用sudo肯定会工作,你有一个例子在“ post-receive hook permission denied”无法创建文件“error ”,将git命令包装在脚本中。 将收到后更改为: sudo sh /usr/local/sbin/prgetsimpleappscom 用visudo改变了sudoers git ALL = (root) NOPASSWD: /bin/sh /usr/local/sbin/prgetsimpleappscom 另一种方法是作为node用户定期提取的cron作业,并且 ... -
在文件上,所以它由'git'用户拥有。 我在网络服务器上没有git用户...所有其他git相关文件都归我的用户或root所有。 这是因为oyur webserver是GitLab服务器的客户端。 您引用的文档用于配置GitLab服务器(将后接收挂钩添加到GitLab存储库)。 因此' git '用户,这是GitLab服务器上的默认用户 。 但是如果你要推送到gitlab.com,你就不会直接添加一个钩子。 您需要声明一个Web挂钩 ,然后发送回您可以侦听的JSON消息以触发另一个操作 。 如果你是唯一一个推 ...
-
sudo可能不会保留GIT_WORK_TREE环境变量 - 它经常被配置为为其运行的命令提供已清理的环境,尤其是当它们以root身份运行时。 git有一些命令行参数( --git-dir和--work-tree ),它们完成环境变量的目的。 在这种情况下,您可能需要使用它们。 sudo is likely not preserving the GIT_WORK_TREE environment variable - it is quite often configured to provide a sani ...