In mongo shell js file can be run using load
command:
load("path/to/file/file.js")
How to do this using spring-data? Or any other way in Java.
I've tried:
BasicDBObject obj = new BasicDBObject();
obj.append( "$load" , "/path/file.js" );
CommandResult t=mongoTemplate.executeCommand(obj);
and:
obj.append( "$eval" , "load("/path/file.js")" );
but it doesn't work.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…