I have stored ObjectId("5e0f216aab9234688b125ac1") in a variable i-e complete value, and in following code iam trying to access EmployeeOID which is an integer
try {
MongoCollection<Document> collection = vars.getObject("collection");
Document result = collection.find(eq("_id",'completeValue').first());
log.info (result)
if(result !=null){
vars.put ("Employeeoid", result.get("EmployeeOID").tointeger());
log.info (Employeeoid)
return "Employeeoid=" + Employeeoid;
}
IAm getting this error:
Response code: 500
Response message: Exception: groovy.lang.MissingMethodException: No signature
of method: com.mongodb.client.model.Filters$SimpleEncodingFilter.first() is
applicable for argument types: () values: []
Possible solutions: print(java.io.PrintWriter), print(java.lang.Object),
find(), find(groovy.lang.Closure), is(java.lang.Object),
printf(java.lang.String, [Ljava.lang.Object;)