mongodb - Error on return a Future[Boolean] from a for in Scala -
I am writing the application 2.3.2 in Scala.
I use reactive Mongo as a driver. My mongodab database I have a collection called "recommendation.tagsSimilarity", which has the value of similarity between my tags, where a tag is in the form Is: "category: attribute".
An example of a document is as follows:
{"_id": ObjectId ("5440ec6e4165e71ac4b53a71"), "id": "10912199495810912197116116114-10912199581091219711611611450", "tags 1 ":" 10912199495810912197116116114 "," tag1Name ":" myc1: Myattr "," tag2 ":" 10912199581091219711611611450 "," tag2name ":" myc: myattr2 "," eq ": 0}
A domain represents an element of the matrix of nxn dimensions, where n is the number of saved tags.
Now I have created a collection called "recommendation.correlation", on which I save the connection between "category" and a tag.
To do this, I am writing a method that repeats elements of tag simulation as matrix. Future [Boolean] = {def calculation (category: string, tag: hard g): future [(double, double)] = {// correlation calculation and tupal values Back) play.Logger.debug ("Start Correlation") similarity. all. Twistlistat {tag match = & gt; Get tag category for (i & lt; - tag match) {val category = i.tag1Name.split (":") (0) // (j but the compiler gives me the following error: What's wrong ?? I do not understand why do not return anything for the statement. In addition to this I would like to ask why I can not write the code to iterate twice in the list in Scala.
[error] / user / alberto / git / Bdrim / modules / recommendation-system / app / recommendationsystem / algorithms / Pearson.scala313: type mismatch; [Error] found: unit [error] is required: scala.concurrent.future [boolean] for [error] (i & lt; - tag match) {[error] ^ [error] / user / alberto / git / bdri / Module / recommendation - system / app / referral system / algorithm / pearson Scala: 313: Type Mismatch; [Error] found: unit [error] required: scala.concurrent.future [boolean] [error] for (i & lt; - tag match) {[error] ^ [error] got an error
you to yield
with for
Forgot to use:
For the (i & lt; - tag match) {. ..}
is translated into a foreach
instruction
(i <- tag match) yield {...} By using this it will actually translate into map / flatmap and generate results (this is for both of its code s).
Comments
Post a Comment