SysCreateIndex
Creates a new index on a custom entity collection.
Service | Operation |
---|---|
customEntity | SYS_CREATE_INDEX |
Usage
http://localhost:3000
- C#
- C++
- Objective-C
- Java
- JavaScript
- Cloud Code
- Raw
// Cloud Code only. To view example, switch to the Cloud Code tab
// Cloud Code only. To view example, switch to the Cloud Code tab
// Cloud Code only. To view example, switch to the Cloud Code tab
// Cloud Code only. To view example, switch to the Cloud Code tab
// Cloud Code only. To view example, switch to the Cloud Code tab
var entityType = "athletes";
var indexName = "penalties_1";
var indexKeysJson = {
"data.penalties": 1
};
var indexOptsJson = {
"sparse": true
};
var customEntityProxy = bridge.getCustomEntityServiceProxy();
var postResult = customEntityProxy.sysCreateIndex(entityType, indexName, indexKeysJson, indexOptsJson);
if (postResult.status == 200) {
// Success!
}
{
"service": "customEntity",
"operation": "SYS_CREATE_INDEX",
"data": {
"entityType": "athletes",
"indexName": "penalties_1",
"indexKeysJson": {
"data.penalties": 1
},
"indexOptsJson": {
"sparse": true
}
}
}
Method Parameters
Parameter | Description |
---|---|
entityType | The entity type identifying the applicable custom entity collection. |
indexName | The name to assign to the new index. |
indexKeysJson | The field index keys, as JSON object. |
indexOptsJson | The index options, as JSON object. |