作曲家 - 无法在Windows上安装mongodb / mongodb(Composer - Unable to install mongodb/mongodb on Windows)
我试图在使用composer的Laravel安装中安装以下软件包:
jenssegers/mongodb
但是当安装时,我收到以下错误:
- jenssegers/mongodb v3.0.0 requires mongodb/mongodb ^1.0.0 -> satisfiable by mongodb/mongodb[1.0.0, 1.0.1]. - jenssegers/mongodb v3.0.1 requires mongodb/mongodb ^1.0.0 -> satisfiable by mongodb/mongodb[1.0.0, 1.0.1]. - jenssegers/mongodb v3.0.2 requires mongodb/mongodb ^1.0.0 -> satisfiable by mongodb/mongodb[1.0.0, 1.0.1]. - mongodb/mongodb 1.0.1 requires ext-mongodb ^1.1.0 -> the requested PHP extension mongodb is missing from your system. - mongodb/mongodb 1.0.0 requires ext-mongodb ^1.1.0 -> the requested PHP extension mongodb is missing from your system. - Installation request for jenssegers/mongodb ^3.0 -> satisfiable by jenssegers/mongodb[v3.0.0, v3.0.1, v3.0.2].
当我运行
composer show -p
时,扩展名实际上是这样列出的:ext-mongo 1.6.12 The mongo PHP extension
当我执行php_info()或其他任何操作时,它也会正确启用。
我也确定我在正确的php.ini文件中启用了它。
其实,我想这个问题来自于它应该被称为
mongodb
而不是mongo
。他们是否有任何针对Windows的解决方案?
谢谢。
I'm trying to install the following package on my Laravel installation using composer :
jenssegers/mongodb
But when installing, I'm getting the following error :
- jenssegers/mongodb v3.0.0 requires mongodb/mongodb ^1.0.0 -> satisfiable by mongodb/mongodb[1.0.0, 1.0.1]. - jenssegers/mongodb v3.0.1 requires mongodb/mongodb ^1.0.0 -> satisfiable by mongodb/mongodb[1.0.0, 1.0.1]. - jenssegers/mongodb v3.0.2 requires mongodb/mongodb ^1.0.0 -> satisfiable by mongodb/mongodb[1.0.0, 1.0.1]. - mongodb/mongodb 1.0.1 requires ext-mongodb ^1.1.0 -> the requested PHP extension mongodb is missing from your system. - mongodb/mongodb 1.0.0 requires ext-mongodb ^1.1.0 -> the requested PHP extension mongodb is missing from your system. - Installation request for jenssegers/mongodb ^3.0 -> satisfiable by jenssegers/mongodb[v3.0.0, v3.0.1, v3.0.2].
The extension is actually listed when I run
composer show -p
like that :ext-mongo 1.6.12 The mongo PHP extension
and it's also enabled correctly when I do php_info() or anything.
I'm also sure that I enabled it in the correct php.ini file.
Actually, I guess that the problem comes from the fact that it should be called
mongodb
instead ofmongo
.Is their any fix for this for Windows ?
Thanks.
原文:https://stackoverflow.com/questions/35994943
最满意答案
您需要明确提供比较器,此时您不需要:
var tenantsList = (from t in db.Tenants select t) .Distinct(new TenantComparer()) .OrderBy( x => x.Name ) .ToList();
请参阅文档 。
You need to provide comparer explicitly, which at the moment you do not:
var tenantsList = (from t in db.Tenants select t) .Distinct(new TenantComparer()) .OrderBy( x => x.Name ) .ToList();
See the documentation.
相关问答
更多-
为什么我的Distinct()不起作用? 因为Distinct 首先检查哈希码(因为它是一个快速检查以查看两个对象是否相等) 然后调用Equals 。 由于您的GetHashCode实现都是相同的(并且与您的Equals方法不对应),因此Distinct无法正常工作。 将GetHashCode方法更改为与Equals对应: public class NormalizedWordComparer : IEqualityComparer
{ public bool Equals(Word ... -
对于SaveEqual您可以自定义检查IEnumerable类型比较 - 您可以检查xEnumerable中的每个项是否包含在yEnumerable 。 注意1 :你这里也有一个错误 - yEnumerable可以包含其他项目,也可以包含重复项目。 但是对于SaveHashCode您没有IEnumerable类型的自定义处理。 您只需返回参数的哈希码。 即使数组包含相同的值,这也会为不同的数组实例提供不同的结果。 要解决此问题,您应该根据集合项计算哈希代码: public int SaveHashCode< ...
-
您需要明确提供比较器,此时您不需要: var tenantsList = (from t in db.Tenants select t) .Distinct(new TenantComparer()) .OrderBy( x => x.Name ) .ToList(); 请参阅文档 。 You need to provide comparer explicitly, which at the moment you do not: var ten ...
-
使用Linq的不同行(Distinct rows using Linq)[2023-10-02]
public IEnumerableGetAllRecords() { var records = _tableName.GetAll() .GroupBy(tb => tb.Date) .Select(g=>g.First()); return records; } 注意 :我们仍然不清楚你想要什么,我们有重复行的Base和ID部分是不同的 ,所以你可能有一些标准或规则在一组Date选择它 ... -
var result = from eachError in SystemErrors let match = Regex.Match(eachError.Description, "...") group eachError by new { FamilyCode = match.Groups["FamilyCode"].Value, ProductPrefix = ma ...
-
你可以使用分组,因为它让我畏缩使用groupBy做一个独特的。 您可以在IGrouping上调用First来从组中获取一个项目,这实际上是一个独特的。 它看起来像这样: var distinctItems = data.GroupBy(item => new{ //include all of the properties that you want to //affect the distinct-ness of the query item.Property1 item.Propert ...
-
MySQL COUNT(CASE WHEN ... THEN DISTINCT列)(MySQL COUNT(CASE WHEN … THEN DISTINCT Column))[2022-02-12]
尝试这个 COUNT(DISTINCT( CASE WHEN YEAR(FieldValue) = YEAR(CURDATE()) AND MONTH(FieldValue) = MONTH(CURDATE()) THEN ColumnID END ) ) AS mtd Try this COUNT(DISTINCT( CASE WHEN YEAR(FieldValue) = YEAR(CURDATE()) AND MONTH(Field ... -
我想你可以使用GroupBy做你想做的事。 var Top5MFG = db.orders .Where (x => x.manufacturer.Length > 0 && x.customerid == "blahblahblahblahblah") .GroupBy(mfg => mfg.manufacturer) .Select(g => g.First()) .OrderByDescending(d => d.date_created ); . ...
-
如果您在通过实体框架等方式评估LINQ表达式时遇到问题,则可以调用.ToList()强制将查询实现到内存中以供进一步处理。 如果您从数据库或其他来源获得的结果非常昂贵,并且可以先进一步缩小,则这不太理想。 IEnumerable
filteredList = originalList .ToList() .GroupBy(customer => customer.CustomerId) .Select(group => group.First()); .ToList()调用 ... -
区别使用条件Linq(Distinct Using Condition Linq)[2022-05-23]
您可能必须自己加入表: from i in Items where i.Category.ServiceProviderID == 2 && !Items.Any(ii=>ii.BaseItemID == i.ID) 你应该做一个join ,这应该是更好的性能。 You might have to join the table on itself: from i in Items where i.Category.ServiceProviderID == 2 && !Items.Any(ii=>ii.Ba ...