dependencies - How to execute n1ql query of Couchbase in scala? -
i want execute nickel query in project , want convert task doing using view perform nickel. possible..??
if yes please provide example , executing nickel queries in scala,and have add additional dependencies in project. if yes please provide link too.
any suggestions appreciated
we planning/working on scala driver, right can use java sdk through scala pretty easily. recommend follow official docs, convert java examples scala: http://docs.couchbase.com/developer/java-2.1/java-intro.html
you want java-client dependency first:
librarydependencies := "com.couchbase.client" % "java-client" % "2.1.4"
if use implict conversions, can make life little easier too:
import com.couchbase.client.java.couchbasecluster import com.couchbase.client.java.query.query import scala.collection.javaconversions._ object connectandquery { def main(args: array[string]): unit = { val cluster = couchbasecluster.create() val bucket = cluster.openbucket("travel-sample") val result = bucket.query(query.simple("select * `travel-sample`limit 10")) result.allrows().map(_.value()).foreach(println) cluster.disconnect() } }
Comments
Post a Comment