Cannot resolve overloaded method - mongodb

in Query for Locations Near a GeoJSON Point
val refPoint = Point(Position(-73.9667, 40.78))
collection.find(Filters.near("geo.coordinates", refPoint, 5000.0, 1000.0)).printResults()
I have these errors:
-Cannot resolve overloaded method 'find'
-Cannot resolve overloaded method 'near'
any one have an idea to solve this?

Related

ERROR: typeerror when() missing 1 required positional argument 'value' in PySpark

I got an above-mentioned error while running a dataframe in a databricks using Pyspark. I don't know how to solve this and where I have gone wrong. The code is as follows:
df_inner_select = df_promodata_daypart.select(df_promodata_daypart.sub_master_id,df_promodata_daypart.sub_campaign_id,df_promodata_daypart.resolved_network,df_promodata_daypart.hh_id,df_promodata_daypart.type,df_df_promodata_daypart.localpromoadviewstarttime_min).alias("viewerbytype").groupby(df_promodata_daypart.sub_master_id,df_promodata_daypart.sub_campaign_id,df_promodata_daypart.resolved_network,df_promodata_daypart.hh_id,df_promodata_daypart.localpromoadviewstarttime_min).agg(F.sum(F.when(df_promodata_daypart.type=="NonTargeted",1).otherwise(0).alias("NonTargeted_count")),F.sum(F.when(df_promodata_daypart.type=="Targeted").alias("Targeted_count")))
and also here I need to get the count of the type column as mentioned in the dataframe. Can anyone help me in solving this with quick response as possible ?
Thanks a lot in advance.
Look at the very end of your line:
F.when(df_promodata_daypart.type=="Targeted")
when function requires a condition and a value but you only passed a condition.

spark example wont compile

Trying to run one of apache sparks example codes (https://github.com/apache/spark/blob/master/examples/src/main/scala/org/apache/spark/examples/graphx/AggregateMessagesExample.scala) I get the following compile error
too many arguments for method sendToDst: (msg: (Int, Double))Unit
[error] Error occurred in an application involving default arguments.
[error] triplet.sendToDst(1, triplet.srcAttr)
[error] ^
[error] one error found
But looking at the mehtods it seems to be correct. Not sure what is wrong here.
It looks like the method you are calling expects a single argument (a Tuple2) and you are passing in 2 arguments.
Try
triplet.sendToDst((1, triplet.srcAttr))

How to Fix undefined function "createpde"

I run a program about partial differential equation in MATLAB, so I used
model = createpde();
But there's an error:
Undefined function 'createpde' for input arguments of type 'double'.
I tried to search the solution and based on another forum, I should use which createpd -all to determine the path of the function. But when I tried to used that command, I got this error:
createpde not found
So how can I fix this error?

How to define trait for adding to Seq?

I have a beginners Scala question. I have a class, Sample which extends the trait SampleAPI. Now I'm trying to build a sequence of Sample instances using seq. I will look something like this:
var samples: Seq[SampleAPI] = Seq()
for(...) {
samples :+= new Sample(...))
}
This gives me the following compiler error: "type mismatch; found : Seq[java.lang.Object] required: Seq[se.uu.medsci.queue.setup.SampleAPI]"
So I tried:
samples :+= (new Sample(sampleName, this, illuminaXMLReportReader)).asInstanceOf[SampleAPI]
Which instead throws a runtime exception, saying that Sample cannot be bast to SampleAPI. I guess that this comes down to a problem in my understanding of the use of traits in Scala. Any help in figuring this out would be much appreciated.
Is the compiler error coming up on this line?
samples :+= new Sample(...))
If so, I think the problem is that your Sample class doesn't actually extend SampleAPI.
What's happening has to do with the contravariant type parameter of the List type in Scala. If you start with a List[SampleAPI], then add a Sample to that list, it needs to find the least-upper-bound on the types included in the list to use as the new type parameter. If Sample is a SampleAPI, then the least-upper-bound is just SampleAPI and you get a List[SampleAPI] as the result of the :+= operation. However, if Sample is not a SampleAPI then the least-upper-bound on the two types is just Object, hence your compiler error saying that it was expecting a Seq[SampleAPI] but found a Seq[Object].

Specify TestNG test groups in Scala

I'm trying to assign groups to TestNG classes and methods in a Scala environment (in Eclipse)
#Test(groups="register")
class RegisterTest {
...
but am encountering the following error:
Multiple markers at this line
- type mismatch; found : java.lang.String("register") required:
Array[java.lang.String]
- annotation argument needs to be a constant; found: "register"{<error>}
I've tried applying groups to individual Scala methods but still encounter the same error.
Any suggestions on how to get around this?
The#Testannotation works as long as it doesn't specify any parameters (same error if dependsOnMethodsparameter is specified).
#DataProviderannotation also works.
The ScalaDoc gives the following example:
#Test(groups = Array("com.mycompany.groups.SlowTest"))
def funTest() {
sb.append("fun!")
assert(sb.toString === "ScalaTest is fun!")
assert(lb.isEmpty)
}
That seems to match the error you get.