I'm trying to build a mongodb $where clause like this:
var whereQuery = "function () {
for (var index in this.relations) {
var current = this.relations[index];
if (current._id == 2) {
return true;
}
}
return false;
}";
This give me a "sun.org.mozilla.javascript.internal.EvaluatorException: unterminated string literal (#192)" on the first line.
If it is not possible, is there another way to do this? Or do I really need to build the entire $where expression on one line?
Gabriel Sauve
How do we make multi lines string in cloud code ?
I'm trying to build a mongodb $where clause like this:
This give me a "sun.org.mozilla.javascript.internal.EvaluatorException: unterminated string literal (#192)" on the first line.
If it is not possible, is there another way to do this? Or do I really need to build the entire $where expression on one line?
In JavaScript you can escape the newline with a \
var whereQuery = "function () { \
for (var index in this.relations) { \
var current = this.relations[index]; \
if (current._id == 2) { \
return true; \
} \
} \
return false; \
}";
Gabriel
- Oldest First
- Popular
- Newest First
Sorted by Oldest FirstTech Support
In JavaScript you can escape the newline with a \
var whereQuery = "function () { \
for (var index in this.relations) { \
var current = this.relations[index]; \
if (current._id == 2) { \
return true; \
} \
} \
return false; \
}";
Gabriel
Gabriel Sauve
Great!
Thanks.
-
Documentation Notes
-
Design issues with user events
-
Using NoSQL
-
Runtime Collections vs Metadata Collections
-
Anonymous authentication from browser app
-
Modules
-
Movement With Unity
-
Problem with url parameters for downloadables
-
Querying NoSql GameSparks database
-
Challenge accesType
See all 2487 topics