public class DBCollection extends Object
| Modifier and Type | Method and Description |
|---|---|
DBCursor |
aggregate(List<BSONObject> objs)
Execute aggregate operation in current collection.
|
void |
alterCollection(BSONObject options)
Alter the attributes of current collection.
|
void |
attachCollection(String subClFullName,
BSONObject options)
Attach the specified collection.
|
InsertResult |
bulkInsert(List<BSONObject> records)
Insert a bulk of bson objects into current collection.
|
InsertResult |
bulkInsert(List<BSONObject> records,
InsertOption option)
Insert a bulk of bson objects into current collection.
|
void |
createAutoIncrement(BSONObject options)
Create auto-increment for current collection.
|
void |
createAutoIncrement(List<BSONObject> options)
Create one or more auto-increment for current collection.
|
void |
createIdIndex(BSONObject options)
Create the id index.
|
void |
createIndex(String indexName,
BSONObject indexKeys,
boolean isUnique,
boolean enforced)
Create a index with indexName and indexKeys
|
void |
createIndex(String indexName,
BSONObject indexKeys,
boolean isUnique,
boolean enforced,
int sortBufferSize)
Create a index with indexName and indexKeys.
|
void |
createIndex(String indexName,
BSONObject indexKeys,
BSONObject options)
Create a index with name and key.
|
void |
createIndex(String indexName,
String indexKeys,
boolean isUnique,
boolean enforced)
Create a index with indexName and indexKeys.
|
void |
createIndex(String indexName,
String indexKeys,
boolean isUnique,
boolean enforced,
int sortBufferSize)
Create a index with indexName and indexKeys.
|
DBLob |
createLob()
Create a lob.
|
DBLob |
createLob(ObjectId id)
Create a lob with a given id.
|
ObjectId |
createLobID()
Just create a lobID from server.
|
ObjectId |
createLobID(Date d)
Just create a lobID from server.
|
DeleteResult |
deleteRecords(BSONObject matcher)
Delete the matching records of current collection.
|
DeleteResult |
deleteRecords(BSONObject matcher,
DeleteOption option)
Delete the matching records of current collection.
|
void |
detachCollection(String subClFullName)
Detach the specified collection.
|
void |
disableCompression()
Alter the attributes of current collection to disable compression
|
void |
disableSharding()
Alter the attributes of current collection to disable sharding
|
void |
dropAutoIncrement(List<String> fieldNames)
Drop one or more auto-increment of current collection.
|
void |
dropAutoIncrement(String fieldName)
Drop auto-increment of current collection.
|
void |
dropIdIndex()
Drop the id index.
|
void |
dropIndex(String indexName)
Remove the named index of current collection.
|
void |
enableCompression(BSONObject options)
Alter the attributes of current collection to enable compression
|
void |
enableSharding(BSONObject options)
Alter the attributes of current collection to enable sharding
|
DBCursor |
explain(BSONObject matcher,
BSONObject selector,
BSONObject orderBy,
BSONObject hint,
long skipRows,
long returnRows,
int flag,
BSONObject options)
Explain query of current collection.
|
CollectionSpace |
getCollectionSpace()
Get the CollectionSpace instance of current collection.
|
long |
getCount()
Get the amount of documents in current collection.
|
long |
getCount(BSONObject matcher)
Get the amount of matching documents in current collection.
|
long |
getCount(BSONObject matcher,
BSONObject hint)
Get the count of matching BSONObject in current collection.
|
String |
getCSName()
Get the full name of specified collection in current collection space.
|
String |
getFullName()
Get the full name of specified collection in current collection space.
|
DBCursor |
getIndexes()
Get all the indexes of current collection
|
BSONObject |
getIndexInfo(String name)
Get the information of specified index in current collection.
|
BSONObject |
getIndexStat(String name)
Get the statistics of the index.
|
BSONObject |
getIndexStat(String name,
boolean detail)
Get the statistics of the index.
|
String |
getName()
Get the name of current collection.
|
DBCursor |
getQueryMeta(BSONObject matcher,
BSONObject orderBy,
BSONObject hint,
long skipRows,
long returnRows,
int flag)
Get index blocks' or data blocks' information for concurrent query.
|
Sequoiadb |
getSequoiadb()
Get the Sequoiadb instance of current collection.
|
InsertResult |
insertRecord(BSONObject record)
Insert a document into current collection.
|
InsertResult |
insertRecord(BSONObject record,
InsertOption option)
Insert a document into current collection.
|
boolean |
isIndexExist(String name)
Test the specified index exist or not.
|
DBCursor |
listLobs()
Get all of the lobs in current collection.
|
DBCursor |
listLobs(BSONObject matcher,
BSONObject selector,
BSONObject orderBy,
BSONObject hint,
long skipRows,
long returnRows)
Get the lobs in current collection.
|
DBLob |
openLob(ObjectId id)
Open an existing lob with id.
|
DBLob |
openLob(ObjectId id,
int mode)
Open an existing lob with id.
|
void |
pop(BSONObject options)
Pop records from the collection.
|
DBCursor |
query()
Get all documents of current collection.
|
DBCursor |
query(BSONObject matcher,
BSONObject selector,
BSONObject orderBy,
BSONObject hint)
Get the matching documents in current collection.
|
DBCursor |
query(BSONObject matcher,
BSONObject selector,
BSONObject orderBy,
BSONObject hint,
int flag)
Get the matching documents in current collection.
|
DBCursor |
query(BSONObject matcher,
BSONObject selector,
BSONObject orderBy,
BSONObject hint,
long skipRows,
long returnRows)
Get the matching documents in current collection.
|
DBCursor |
query(BSONObject matcher,
BSONObject selector,
BSONObject orderBy,
BSONObject hint,
long skipRows,
long returnRows,
int flags)
Get the matching documents in current collection.
|
DBCursor |
query(DBQuery matcher)
Get the matching documents in current collection.
|
DBCursor |
query(String matcher,
String selector,
String orderBy,
String hint)
Get the matching documents in current collection.
|
DBCursor |
queryAndRemove(BSONObject matcher,
BSONObject selector,
BSONObject orderBy,
BSONObject hint,
long skipRows,
long returnRows,
int flag)
Get the matching documents in current collection and remove.
|
DBCursor |
queryAndUpdate(BSONObject matcher,
BSONObject selector,
BSONObject orderBy,
BSONObject hint,
BSONObject update,
long skipRows,
long returnRows,
int flag,
boolean returnNew)
Get the matching documents in current collection and update.
|
BSONObject |
queryOne()
Get one document from current collection.
|
BSONObject |
queryOne(BSONObject matcher,
BSONObject selector,
BSONObject orderBy,
BSONObject hint,
int flag)
Get one matched document from current collection.
|
void |
removeLob(ObjectId lobId)
Remove an existing lob.
|
<T> void |
save(List<T> type)
Insert an object into current collection.
|
<T> void |
save(List<T> type,
Boolean ignoreNullValue)
Insert an object into current collection.
|
<T> void |
save(List<T> type,
Boolean ignoreNullValue,
int flag)
Insert an object into current collection.
|
<T> void |
save(T type)
Insert an object into current collection.
|
<T> void |
save(T type,
Boolean ignoreNullValue)
Insert an object into current collection when save include update shardingKey field, the
shardingKey modify action is not take effect, but the other field update is take effect.
|
<T> void |
save(T type,
Boolean ignoreNullValue,
int flag)
Insert an object into current collection.
|
void |
setAttributes(BSONObject options)
Alter the attributes of current collection Can't alter attributes about split in partition
collection; After altering a collection to be a partition collection, need to split this
collection manually.
|
void |
setMainKeys(String[] keys)
Set the main keys used in save().
|
void |
split(String sourceGroupName,
String destGroupName,
BSONObject splitCondition,
BSONObject splitEndCondition)
Split the specified collection from source group to target group by range.
|
void |
split(String sourceGroupName,
String destGroupName,
double percent)
Split the specified collection from source group to target group by percent.
|
long |
splitAsync(String sourceGroupName,
String destGroupName,
BSONObject splitCondition,
BSONObject splitEndCondition)
Split the specified collection from source group to target group by range asynchronously.
|
long |
splitAsync(String sourceGroupName,
String destGroupName,
double percent)
Split the specified collection from source group to target group by percent asynchronously.
|
void |
truncate()
Truncate the collection.
|
void |
truncateLob(ObjectId lobId,
long length)
Truncate an existing lob.
|
UpdateResult |
updateRecords(BSONObject matcher,
BSONObject modifier)
Update the matching records of current collection.
|
UpdateResult |
updateRecords(BSONObject matcher,
BSONObject modifier,
UpdateOption option)
Update the matching records of current collection.
|
UpdateResult |
upsertRecords(BSONObject matcher,
BSONObject modifier)
Update the matching records of current collection, insert if no matching.
|
UpdateResult |
upsertRecords(BSONObject matcher,
BSONObject modifier,
UpsertOption option)
Update the matching records of current collection, insert if no matching.
|
public DBCursor aggregate(List<BSONObject> objs) throws BaseException
objs - The Bson object of rule list, can't be nullBaseException - If error happens.public void alterCollection(BSONObject options) throws BaseException
options - The options for altering current collection are as below:
BaseException - If error happens.public void attachCollection(String subClFullName, BSONObject options) throws BaseException
subClFullName - The full name of the sub-collectionoptions - The low boundary and up boundary eg: {"LowBound":{a:1},"UpBound":{a:100}}BaseException - If error happens.public InsertResult bulkInsert(List<BSONObject> records) throws BaseException
records - The Bson object of record list, can't be null. insert will interrupt when
Duplicate key exist.InsertResultBaseException - If error happens.public InsertResult bulkInsert(List<BSONObject> records, InsertOption option) throws BaseException
records - The Bson object of record list, can't be null. insert will interrupt when
Duplicate key exist.option - InsertOptionInsertResultBaseException - If error happens.public void createAutoIncrement(BSONObject options)
options - The options for creating auto-increment are as below:
BaseException - If error happens.public void createAutoIncrement(List<BSONObject> options)
options - The options of the auto-increment(s)BaseException - If error happens.public void createIdIndex(BSONObject options) throws BaseException
options - can be empty or specify option. e.g. {SortBufferSize:64}BaseException - If error happens.public void createIndex(String indexName, BSONObject indexKeys, boolean isUnique, boolean enforced) throws BaseException
indexName - The index indexName.indexKeys - The index keys in JSON format, like: { "a":1, "b":-1}.isUnique - Whether the index elements are unique or not.enforced - Whether the index is enforced unique, this element is meaningful when isUnique is
set to true.BaseException - If error happens.public void createIndex(String indexName, BSONObject indexKeys, boolean isUnique, boolean enforced, int sortBufferSize) throws BaseException
indexName - The index indexName.indexKeys - The index keys in JSON format, like: { "a":1, "b":-1 }.isUnique - Whether the index elements are unique or not.enforced - Whether the index is enforced unique, this element is meaningful when isUnique is
set to true.sortBufferSize - The size(MB) of sort buffer used when creating index, zero means don't use sort
buffer.BaseException - If error happens.public void createIndex(String indexName, BSONObject indexKeys, BSONObject options) throws BaseException
indexName - The index name.indexKeys - The index keys in JSON format, like: { "a":1, "b":-1 }.options - Optional configuration, type is BSONObject. Please reference
here
for more detail, like: { "Unique" : false , "Enforced" : false , "NotNull" : false , "SortBufferSize" : 64 }BaseExceptionpublic void createIndex(String indexName, String indexKeys, boolean isUnique, boolean enforced) throws BaseException
indexName - The index indexName.indexKeys - The index keys in JSON format, like: "{\"a\":1, \"b\":-1}".isUnique - Whether the index elements are unique or not.enforced - Whether the index is enforced unique, this element is meaningful when isUnique is
set to true.BaseException - If error happens.public void createIndex(String indexName, String indexKeys, boolean isUnique, boolean enforced, int sortBufferSize) throws BaseException
indexName - The index indexName.indexKeys - The index keys in JSON format, like: "{\"a\":1, \"b\":-1}".isUnique - Whether the index elements are unique or not.enforced - Whether the index is enforced unique, this element is meaningful when isUnique is
set to true.sortBufferSize - The size(MB) of sort buffer used when creating index, zero means don't use sort
buffer.BaseException - If error happens.public DBLob createLob() throws BaseException
BaseException - If error happens..public DBLob createLob(ObjectId id) throws BaseException
id - the lob's id. if id is null, it will be generated in this functionBaseException - If error happens..public ObjectId createLobID() throws BaseException
BaseException - If error happens..public ObjectId createLobID(Date d) throws BaseException
d - LobID's relative time. if d is NULL the relative time will be server's system timeBaseException - If error happens..public DeleteResult deleteRecords(BSONObject matcher) throws BaseException
matcher - The matching condition, match all the documents if null.DeleteResultBaseException - If error happens.public DeleteResult deleteRecords(BSONObject matcher, DeleteOption option) throws BaseException
matcher - The matching condition, match all the documents if null.option - DeleteOptionDeleteResultBaseException - If error happens.public void detachCollection(String subClFullName) throws BaseException
subClFullName - The full name of the sub-collectionBaseException - If error happens.public void disableCompression()
throws BaseException
BaseException - If error happens.public void disableSharding()
throws BaseException
BaseException - If error happens.public void dropAutoIncrement(List<String> fieldNames)
fieldNames - The auto-increment field name(s)BaseException - If error happens.public void dropAutoIncrement(String fieldName)
fieldName - The auto-increment field nameBaseException - If error happens.public void dropIdIndex()
throws BaseException
BaseException - If error happens.public void dropIndex(String indexName) throws BaseException
indexName - The index indexName.BaseException - If error happens.public void enableCompression(BSONObject options) throws BaseException
options - The options for altering current collection are as below:
BaseException - If error happens.public void enableSharding(BSONObject options) throws BaseException
options - The options for altering current collection are as below:
BaseException - If error happens.public DBCursor explain(BSONObject matcher, BSONObject selector, BSONObject orderBy, BSONObject hint, long skipRows, long returnRows, int flag, BSONObject options) throws BaseException
matcher - the matching rule, return all the documents if nullselector - the selective rule, return the whole document if nullorderBy - the ordered rule, never sort if nullhint - Specified the index used to scan data. e.g. {"":"ageIndex"} means using index
"ageIndex" to scan data(index scan); {"":null} means table scan. when hint is
null, database automatically match the optimal index to scan data.skipRows - skip the first numToSkip documents, never skip if this parameter is 0returnRows - return the specified amount of documents, when returnRows is 0, return nothing,
when returnRows is -1, return all the documentsflag - the query flag, default to be 0:
options - The rules of query explain, the options are as below:
BaseException - If error happens.public CollectionSpace getCollectionSpace()
public long getCount()
throws BaseException
BaseException - If error happens.public long getCount(BSONObject matcher) throws BaseException
matcher - The matching rule, when condition is null, the return amount contains all the
records.BaseException - If error happens.public long getCount(BSONObject matcher, BSONObject hint) throws BaseException
matcher - The matching rule, when condition is null, the return amount contains all the
records.hint - Specified the index used to scan data. e.g. {"":"ageIndex"} means using index
"ageIndex" to scan data(index scan); {"":null} means table scan. when hint is
null, database automatically match the optimal index to scan data.BaseException - If error happens.public String getCSName()
public String getFullName()
public DBCursor getIndexes() throws BaseException
BaseException - If error happens.public BSONObject getIndexInfo(String name) throws BaseException
name - The index name.BaseException - If error happens or the specified index does not exist.public BSONObject getIndexStat(String name) throws BaseException
name - The index name.BaseException - If error happens.public BSONObject getIndexStat(String name, boolean detail) throws BaseException
name - The index name.detail - Whether to get additional MCV (Most Common Values) statistics of index.BaseException - If error happens.public String getName()
public DBCursor getQueryMeta(BSONObject matcher, BSONObject orderBy, BSONObject hint, long skipRows, long returnRows, int flag) throws BaseException
matcher - the matching rule, return all the meta information if nullorderBy - the ordered rule, never sort if nullhint - Specified the index used to scan data. e.g. {"":"ageIndex"} means using index
"ageIndex" to scan data(index scan); {"":null} means table scan. when hint is
null, database automatically match the optimal index to scan data.skipRows - The rows to be skippedreturnRows - return the specified amount of documents, when returnRows is 0, return nothing,
when returnRows is -1, return all the documentsflag - The flag to use which form for record data 0: bson stream 1: binary data stream,
form: col1|col2|col3BaseException - If error happens.public Sequoiadb getSequoiadb()
public InsertResult insertRecord(BSONObject record) throws BaseException
record - The bson object to be inserted, can't be null.InsertResultBaseException - If error happens.public InsertResult insertRecord(BSONObject record, InsertOption option) throws BaseException
record - The bson object to be inserted, can't be null.option - InsertOptionInsertResultBaseException - If error happens.public boolean isIndexExist(String name)
name - The index name.public DBCursor listLobs() throws BaseException
BaseException - If error happens.public DBCursor listLobs(BSONObject matcher, BSONObject selector, BSONObject orderBy, BSONObject hint, long skipRows, long returnRows) throws BaseException
matcher - the matching rule, return all the lobs if nullselector - the selective rule, return the whole lobs if nullorderBy - the ordered rule, never sort if nullhint - Specified options. e.g. {"ListPieces": 1} means get the detail piece info of lobs;skipRows - skip the first numToSkip lobs, never skip if this parameter is 0returnRows - return the specified amount of lobs, when returnRows is 0, return nothing, when
returnRows is -1, return all the lobsBaseException - If error happens.public DBLob openLob(ObjectId id) throws BaseException
id - the lob's id.BaseException - If error happens.public DBLob openLob(ObjectId id, int mode) throws BaseException
id - the lob's id.mode - open mode as follow:
DBLob.SDB_LOB_READ
DBLob.SDB_LOB_SHAREREAD
DBLob.SDB_LOB_WRITE
DBLob.SDB_LOB_SHAREREAD | DBLob.SDB_LOB_WRITE for both reading and writing
BaseException - If error happens..public void pop(BSONObject options) throws BaseException
options - the pop option for the operation, including a record LogicalID, and an optional
Direction: 1 for forward pop and -1 for backward popBaseException - If error happens.public DBCursor query() throws BaseException
BaseException - If error happens.public DBCursor query(BSONObject matcher, BSONObject selector, BSONObject orderBy, BSONObject hint) throws BaseException
matcher - the matching rule, return all the documents if nullselector - the selective rule, return the whole document if nullorderBy - the ordered rule, never sort if nullhint - Specified the index used to scan data. e.g. {"":"ageIndex"} means using index
"ageIndex" to scan data(index scan); {"":null} means table scan. when hint is
null, database automatically match the optimal index to scan data.BaseException - If error happens.public DBCursor query(BSONObject matcher, BSONObject selector, BSONObject orderBy, BSONObject hint, int flag) throws BaseException
matcher - the matching rule, return all the documents if nullselector - the selective rule, return the whole document if nullorderBy - the ordered rule, never sort if nullhint - Specified the index used to scan data. e.g. {"":"ageIndex"} means using index
"ageIndex" to scan data(index scan); {"":null} means table scan. when hint is
null, database automatically match the optimal index to scan data.flag - the query flag, default to be 0:
BaseException - If error happens.public DBCursor query(BSONObject matcher, BSONObject selector, BSONObject orderBy, BSONObject hint, long skipRows, long returnRows) throws BaseException
matcher - the matching rule, return all the documents if nullselector - the selective rule, return the whole document if nullorderBy - the ordered rule, never sort if nullhint - Specified the index used to scan data. e.g. {"":"ageIndex"} means using index
"ageIndex" to scan data(index scan); {"":null} means table scan. when hint is
null, database automatically match the optimal index to scan data.skipRows - skip the first numToSkip documents, never skip if this parameter is 0returnRows - return the specified amount of documents, when returnRows is 0, return nothing,
when returnRows is -1, return all the documentsBaseException - If error happens.public DBCursor query(BSONObject matcher, BSONObject selector, BSONObject orderBy, BSONObject hint, long skipRows, long returnRows, int flags) throws BaseException
matcher - the matching rule, return all the documents if nullselector - the selective rule, return the whole document if nullorderBy - the ordered rule, never sort if nullhint - Specified the index used to scan data. e.g. {"":"ageIndex"} means using index
"ageIndex" to scan data(index scan); {"":null} means table scan. when hint is
null, database automatically match the optimal index to scan data.skipRows - skip the first numToSkip documents, never skip if this parameter is 0returnRows - return the specified amount of documents, when returnRows is 0, return nothing,
when returnRows is -1, return all the documentsflags - the query flag, default to be 0:
BaseException - If error happens.public DBCursor query(DBQuery matcher) throws BaseException
matcher - the matching rule, return all the documents if nullBaseException - If error happens.DBQuerypublic DBCursor query(String matcher, String selector, String orderBy, String hint) throws BaseException
matcher - the matching rule, return all the documents if nullselector - the selective rule, return the whole document if nullorderBy - the ordered rule, never sort if nullhint - Specified the index used to scan data. e.g. {"":"ageIndex"} means using index
"ageIndex" to scan data(index scan); {"":null} means table scan. when hint is
null, database automatically match the optimal index to scan data.BaseException - If error happens.public DBCursor queryAndRemove(BSONObject matcher, BSONObject selector, BSONObject orderBy, BSONObject hint, long skipRows, long returnRows, int flag) throws BaseException
matcher - the matching rule, return all the documents if nullselector - the selective rule, return the whole document if nullorderBy - the ordered rule, never sort if nullhint - Specified the index used to scan data. e.g. {"":"ageIndex"} means using index
"ageIndex" to scan data(index scan); {"":null} means table scan. when hint is
null, database automatically match the optimal index to scan data.skipRows - skip the first numToSkip documents, never skip if this parameter is 0returnRows - return the specified amount of documents, when returnRows is 0, return nothing,
when returnRows is -1, return all the documentsflag - the query flag, default to be 0:
BaseException - If error happens.public DBCursor queryAndUpdate(BSONObject matcher, BSONObject selector, BSONObject orderBy, BSONObject hint, BSONObject update, long skipRows, long returnRows, int flag, boolean returnNew) throws BaseException
matcher - the matching rule, return all the documents if nullselector - the selective rule, return the whole document if nullorderBy - the ordered rule, never sort if nullupdate - the update rule, can't be nullhint - Specified the index used to scan data. e.g. {"":"ageIndex"} means using index
"ageIndex" to scan data(index scan); {"":null} means table scan. when hint is
null, database automatically match the optimal index to scan data.skipRows - skip the first numToSkip documents, never skip if this parameter is 0returnRows - return the specified amount of documents, when returnRows is 0, return nothing,
when returnRows is -1, return all the documentsflag - the query flag, default to be 0:
returnNew - When true, returns the updated document rather than the originalBaseException - If error happens.public BSONObject queryOne() throws BaseException
BaseException - If error happens.public BSONObject queryOne(BSONObject matcher, BSONObject selector, BSONObject orderBy, BSONObject hint, int flag) throws BaseException
matcher - the matching rule, return all the documents if nullselector - the selective rule, return the whole document if nullorderBy - the ordered rule, never sort if nullhint - Specified the index used to scan data. e.g. {"":"ageIndex"} means using index
"ageIndex" to scan data(index scan); {"":null} means table scan. when hint is
null, database automatically match the optimal index to scan data.flag - the query flag, default to be 0:
BaseException - If error happens.public void removeLob(ObjectId lobId) throws BaseException
lobId - the lob's id.BaseException - If error happens..public <T> void save(List<T> type) throws BaseException
type - The List instance of insertor, can't be null or emptyBaseException - 1.while the input argument is null or the List instance is empty 2.while the type
is not support, throw BaseException with the type "SDB_INVALIDARG" 3.while offer
main keys by setMainKeys(), and try to update "_id" field, it may get a
BaseException with the type of "SDB_IXM_DUP_KEY" when the "_id" field you want to
update to had been existing in databasesetMainKeys(String[])public <T> void save(List<T> type, Boolean ignoreNullValue) throws BaseException
type - The List instance of insertor, can't be null or emptyignoreNullValue - true:if type's inner value is null, it will not save to collection; false:if
type's inner value is null, it will save to collection too.BaseException - 1.while the input argument is null or the List instance is empty 2.while the type
is not support, throw BaseException with the type "SDB_INVALIDARG" 3.while offer
main keys by setMainKeys(), and try to update "_id" field, it may get a
BaseException with the type of "SDB_IXM_DUP_KEY" when the "_id" field you want to
update to had been existing in databasesetMainKeys(String[])public <T> void save(List<T> type, Boolean ignoreNullValue, int flag) throws BaseException
type - The List instance of insertor, can't be null or emptyignoreNullValue - true:if type's inner value is null, it will not save to collection;flag - the update flag, default to be 0:
BaseException - 1.while the input argument is null or the List instance is empty 2.while the type
is not support, throw BaseException with the type "SDB_INVALIDARG" 3.while offer
main keys by setMainKeys(), and try to update "_id" field, it may get a
BaseException with the type of "SDB_IXM_DUP_KEY" when the "_id" field you want to
update to had been existing in databasesetMainKeys(String[])public <T> void save(T type)
throws BaseException
type - The object of insertor, can't be nullBaseException - 1.when the type is not support, throw BaseException with the type
"SDB_INVALIDARG" 2.when offer main keys by setMainKeys(), and try to update "_id"
field, it may get a BaseException with the type of "SDB_IXM_DUP_KEY"setMainKeys(String[])public <T> void save(T type,
Boolean ignoreNullValue)
throws BaseException
type - The object of insertor, can't be nullignoreNullValue - true:if type's inner value is null, it will not save to collection; false:if
type's inner value is null, it will save to collection too.BaseException - 1.when the type is not support, throw BaseException with the type
"SDB_INVALIDARG" 2.when offer main keys by setMainKeys(), and try to update "_id"
field, it may get a BaseException with the type of "SDB_IXM_DUP_KEY"setMainKeys(String[])public <T> void save(T type,
Boolean ignoreNullValue,
int flag)
throws BaseException
type - The object of insertor, can't be nullignoreNullValue - true:if type's inner value is null, it will not save to collection;flag - the update flag, default to be 0:
BaseException - 1.when the type is not support, throw BaseException with the type
"SDB_INVALIDARG" 2.when offer main keys by setMainKeys(), and try to update "_id"
field, it may get a BaseException with the type of "SDB_IXM_DUP_KEY"setMainKeys(String[])public void setAttributes(BSONObject options) throws BaseException
options - The options for altering current collection are as below:
BaseException - If error happens.public void setMainKeys(String[] keys) throws BaseException
keys - the main keys specified by user. the main key should exist in the objectBaseException - when keys is nullpublic void split(String sourceGroupName, String destGroupName, BSONObject splitCondition, BSONObject splitEndCondition) throws BaseException
sourceGroupName - the source group namedestGroupName - the destination group namesplitCondition - the split conditionsplitEndCondition - the split end condition or null, only usable when "ShardingType" is "range". eg:If
we create a collection with the option
{ShardingKey:{"age":1},ShardingType:"range"}, we can fill {age:30} as the
splitCondition, and fill {age:60} as the splitEndCondition. when split, the target
group will get the records whose age's hash value are in [30,60). If
splitEndCondition is null, they are in [30,max).BaseException - If error happens.public void split(String sourceGroupName, String destGroupName, double percent) throws BaseException
sourceGroupName - the source group namedestGroupName - the destination group namepercent - the split percent, Range:(0,100]BaseException - If error happens.public long splitAsync(String sourceGroupName, String destGroupName, BSONObject splitCondition, BSONObject splitEndCondition) throws BaseException
sourceGroupName - the source group namedestGroupName - the destination group namesplitCondition - the split conditionsplitEndCondition - the split end condition or null, only usable when "ShardingType" is "range". eg:If
we create a collection with the option
{ShardingKey:{"age":1},ShardingType:"range"}, we can fill {age:30} as the
splitCondition, and fill {age:60} as the splitEndCondition. when split, the target
group will get the records whose age's hash values are in [30,60). If
splitEndCondition is null, they are in [30,max).BaseException - If error happens.Sequoiadb.listTasks(BSONObject, BSONObject, BSONObject, BSONObject),
Sequoiadb.cancelTask(long, boolean)public long splitAsync(String sourceGroupName, String destGroupName, double percent) throws BaseException
sourceGroupName - the source group namedestGroupName - the destination group namepercent - the split percent, Range:(0,100]BaseException - If error happens.public void truncate()
throws BaseException
BaseException - If error happens.public void truncateLob(ObjectId lobId, long length) throws BaseException
lobId - the lob's id.length - the truncate lengthBaseException - If error happens.public UpdateResult updateRecords(BSONObject matcher, BSONObject modifier) throws BaseException
matcher - The matching condition, match all the documents if nullmodifier - The updating rule, can't be nullUpdateResultBaseException - If error happens.public UpdateResult updateRecords(BSONObject matcher, BSONObject modifier, UpdateOption option) throws BaseException
matcher - The matching condition, match all the documents if nullmodifier - The updating rule, can't be nulloption - UpdateOptionUpdateResultBaseException - If error happens.public UpdateResult upsertRecords(BSONObject matcher, BSONObject modifier) throws BaseException
matcher - The matching condition, match all the documents if nullmodifier - The updating rule, can't be nullUpdateResultBaseException - If error happens.public UpdateResult upsertRecords(BSONObject matcher, BSONObject modifier, UpsertOption option) throws BaseException
matcher - The matching condition, match all the documents if nullmodifier - The updating rule, can't be nulloption - UpsertOptionUpdateResultBaseException - If error happens.Copyright © 2023. All rights reserved.