は私の問題の解決策です:それと
// SAMPLE STORED PROCEDURE
function deleteActivitiesBackDate(numberOfDays) {
var context = getContext();
var collection = context.getCollection();
var link = collection.getSelfLink();
var response = context.getResponse();
//validate inputs
if(!numberOfDays || (typeof numberOfDays != "string")){
return errorResponse(400, (!numberOfDays) ? "numberOfDays is Undefined":"String type is expected for numberOfDays.");
}
var targetDate = new Date();
targetDate.setDate(targetDate.getDate() - numberOfDays);
console.log("targetDate is "+targetDate);
var query = 'SELECT * FROM activities a WHERE a.activityDate < "' + targetDate+ '"';
var run = collection.queryDocuments(link, query, {}, callback);
function callback(err, docs) {
if (err){
return errorResponse(400, err.message);
}
if (docs.length > 0){
deleteDoc(docs);
}else {
return errorResponse(400, "The document was not found.");
}
}
if (!run) {
return errorResponse(400, "The document could not be deleted.");
}
function deleteDoc(document) {
var docDeleted = collection.deleteDocument(document._self, function(err, result){
if (err){
return errorResponse(400, err.message);
}
response.setBody(result);
});
if (!docDeleted) {
return errorResponse(400, "The document could not be deleted.");
}
};
function errorResponse(code,message){
var errorObj = {};
errorObj.code = code;
errorObj.message = message;
errorObj.date = getDateTime();
return response.setBody(errorObj);
}
function getDateTime(){
var currentdate = new Date();
var dateTime = currentdate.getFullYear() + "-" +(currentdate.getMonth()+1)+ "-" + currentdate.getDate()+ " " +currentdate.getHours()+":"+currentdate.getMinutes()+":"+currentdate.getSeconds();
return dateTime;
}
}
あなたも(<,>,<=,>=,!=)
を実行するためにパーティションを有効にする必要がありますので、試してみてください。 ![This](https://i.stack.imgur.com/DIPrj.png)
もcustom
内JSONを以下している
{
"indexingMode": "consistent",
"automatic": true,
"includedPaths": [
{
"path": "/*",
"indexes": [
{
"kind": "Range",
"dataType": "String",
"precision": -1
},
{
"kind": "Range",
"dataType": "Number",
"precision": -1
},
{
"kind": "Spatial",
"dataType": "Point"
},
{
"kind": "Spatial",
"dataType": "Polygon"
}
]
}
],
"excludedPaths": []
}
ありがとう