public class DBCollection extends Object
限定符和类型 | 字段和说明 |
---|---|
static int |
FLG_INSERT_CONTONDUP
This flags represent that bulkInsert will continue when
duplicate key exist(the duplicate record will be ignored).
|
static int |
FLG_UPDATE_KEEP_SHARDINGKEY
The sharding key in update rule is not filtered,
when executing update or upsert.
|
限定符和类型 | 方法和说明 |
---|---|
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.
|
void |
createIdIndex(BSONObject options)
Create the id index.
|
void |
createIndex(String name,
BSONObject key,
boolean isUnique,
boolean enforced)
Create a index with name and key
|
void |
createIndex(String name,
BSONObject key,
boolean isUnique,
boolean enforced,
int sortBufferSize)
Create a index with name and key.
|
void |
createIndex(String name,
String key,
boolean isUnique,
boolean enforced)
Create a index with name and key.
|
void |
createIndex(String name,
String key,
boolean isUnique,
boolean enforced,
int sortBufferSize)
Create a index with name and key.
|
DBLob |
createLob()
Create a lob.
|
DBLob |
createLob(ObjectId id)
Create a lob with a given id.
|
void |
delete(BSONObject matcher)
Delete the matching BSONObject of current collection.
|
void |
delete(BSONObject matcher,
BSONObject hint)
Delete the matching BSONObject of current collection.
|
void |
delete(String matcher)
Delete the matching of current collection.
|
void |
delete(String matcher,
String hint)
Delete the matching bson's string 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 |
dropIdIndex()
Drop the id index.
|
void |
dropIndex(String name)
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
|
void |
ensureOID(boolean flag)
Set whether ensure OID of record when bulk insert records to SequoiaDB.
|
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.
|
long |
getCount(String matcher)
Get the amount of matching documents 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.
|
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.
|
Object |
insert(BSONObject insertor)
Insert a document into current collection, if the document
does not contain field "_id", it will be added.
|
void |
insert(List<BSONObject> insertor)
Insert a bulk of bson objects into current collection.
|
void |
insert(List<BSONObject> insertor,
int flag)
Insert a bulk of bson objects into current collection.
|
Object |
insert(String insertor)
Insert a document into current collection, if the document
does not contain field "_id", it will be added.
|
boolean |
isIndexExist(String name)
Test the specified index exist or not.
|
boolean |
isOIDEnsured() |
DBCursor |
listLobs()
Get all of 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 |
query(String matcher,
String selector,
String orderBy,
String hint,
int flag)
Get the matching documents in current collection.
|
DBCursor |
query(String matcher,
String selector,
String orderBy,
String hint,
long skipRows,
long returnRows)
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(). if no main keys are set, use the
default main key "_id".
|
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.
|
void |
update(BSONObject matcher,
BSONObject modifier,
BSONObject hint)
Update the BSONObject of current collection.
|
void |
update(BSONObject matcher,
BSONObject modifier,
BSONObject hint,
int flag)
Update the BSONObject of current collection.
|
void |
update(DBQuery query)
Update the document of current collection.
|
void |
update(String matcher,
String modifier,
String hint)
Update the BSONObject of current collection.
|
void |
update(String matcher,
String modifier,
String hint,
int flag)
Update the BSONObject of current collection.
|
void |
upsert(BSONObject matcher,
BSONObject modifier,
BSONObject hint)
Update the BSONObject of current collection, insert if no matching.
|
void |
upsert(BSONObject matcher,
BSONObject modifier,
BSONObject hint,
BSONObject setOnInsert)
Update the BSONObject of current collection, insert if no matching.
|
void |
upsert(BSONObject matcher,
BSONObject modifier,
BSONObject hint,
BSONObject setOnInsert,
int flag)
Update the BSONObject of current collection, insert if no matching.
|
public static final int FLG_INSERT_CONTONDUP
public static final int FLG_UPDATE_KEEP_SHARDINGKEY
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 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 name, BSONObject key, boolean isUnique, boolean enforced) throws BaseException
name
- The index namekey
- The index keys in JSON format, like: "{\"a\":1, \"b\":-1}"isUnique
- Whether the index elements are unique or notenforced
- Whether the index is enforced unique This element is
meaningful when isUnique is set to trueBaseException
- If error happens.public void createIndex(String name, BSONObject key, boolean isUnique, boolean enforced, int sortBufferSize) throws BaseException
name
- The index namekey
- The index keys in JSON format, like: "{\"a\":1, \"b\":-1}"isUnique
- Whether the index elements are unique or notenforced
- Whether the index is enforced unique This element is
meaningful when isUnique is set to truesortBufferSize
- The size(MB) of sort buffer used when creating index,
zero means don't use sort bufferBaseException
- If error happens.public void createIndex(String name, String key, boolean isUnique, boolean enforced) throws BaseException
name
- The index namekey
- The index keys in JSON format, like: "{\"a\":1, \"b\":-1}"isUnique
- Whether the index elements are unique or notenforced
- Whether the index is enforced unique This element is
meaningful when isUnique is set to trueBaseException
- If error happens.public void createIndex(String name, String key, boolean isUnique, boolean enforced, int sortBufferSize) throws BaseException
name
- The index namekey
- The index keys in JSON format, like: "{\"a\":1, \"b\":-1}"isUnique
- Whether the index elements are unique or notenforced
- Whether the index is enforced unique This element is
meaningful when isUnique is set to truesortBufferSize
- The size(MB) of sort buffer used when creating index,
zero means don't use sort bufferBaseException
- 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 void delete(BSONObject matcher) throws BaseException
matcher
- The matching condition, delete all the documents if nullBaseException
- If error happens.public void delete(BSONObject matcher, BSONObject hint) throws BaseException
matcher
- The matching condition, delete all the documents 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 void delete(String matcher) throws BaseException
matcher
- The matching condition, delete all the documents if nullBaseException
- If error happens.public void delete(String matcher, String hint) throws BaseException
matcher
- The matching condition, delete all the documents 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 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 dropIdIndex() throws BaseException
BaseException
- If error happens.public void dropIndex(String name) throws BaseException
name
- The index nameBaseException
- 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 void ensureOID(boolean flag)
flag
- whether ensure OID of recordpublic 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. Please see the definition
of follow flags for more detail. Usage:
e.g. set ( DBQuery.FLG_QUERY_FORCE_HINT | DBQuery.FLG_QUERY_WITH_RETURNDATA ) to param flag
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 long getCount(String matcher) throws BaseException
matcher
- the matching ruleBaseException
- 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 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 Object insert(BSONObject insertor) throws BaseException
insertor
- The Bson object of insertor, can't be nullBaseException
- If error happens.public void insert(List<BSONObject> insertor) throws BaseException
insertor
- The Bson object of insertor list, can't be null.
insert will interrupt when Duplicate key exist.BaseException
- If error happens.public void insert(List<BSONObject> insertor, int flag) throws BaseException
insertor
- The Bson object of insertor list, can't be nullflag
- available value is FLG_INSERT_CONTONDUP or 0.
if flag = FLG_INSERT_CONTONDUP, bulkInsert will continue when Duplicate
key exist.(the duplicate record will be ignored);
if flag = 0, bulkInsert will interrupt when Duplicate key exist.BaseException
- If error happens.public Object insert(String insertor) throws BaseException
insertor
- The string of insertorBaseException
- If error happens.public boolean isIndexExist(String name)
name
- The index name.public boolean isOIDEnsured()
public DBCursor listLobs() throws BaseException
BaseException
- 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:
DBLob.SDB_LOB_READ for reading,
DBLob.SDB_LOB_WRITE for 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. Please see the definition
of follow flags for more detail. Usage:
e.g. set ( DBQuery.FLG_QUERY_FORCE_HINT | DBQuery.FLG_QUERY_WITH_RETURNDATA ) to param flag
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 flags, default to be 0. Please see the definition
of follow flags for more detail. Usage:
e.g. set ( DBQuery.FLG_QUERY_FORCE_HINT | DBQuery.FLG_QUERY_WITH_RETURNDATA ) to param flag
BaseException
- If error happens.public DBCursor query(DBQuery matcher) throws BaseException
matcher
- the matching rule, return all the documents if nullBaseException
- If error happens.DBQuery
public 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 query(String matcher, String selector, String orderBy, String 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. Please see the definition
of follow flags for more detail. Usage:
e.g. set ( DBQuery.FLG_QUERY_FORCE_HINT | DBQuery.FLG_QUERY_WITH_RETURNDATA ) to param flag
BaseException
- If error happens.public DBCursor query(String matcher, String selector, String orderBy, String 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 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. Please see the definition
of follow flags for more detail. Usage:
e.g. set ( DBQuery.FLG_QUERY_FORCE_HINT | DBQuery.FLG_QUERY_WITH_RETURNDATA ) to param flag
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 flags, default to be 0. Please see the definition
of follow flags for more detail. Usage:
e.g. set ( DBQuery.FLG_QUERY_FORCE_HINT | DBQuery.FLG_QUERY_WITH_RETURNDATA ) to param flag
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. Please see the definition
of follow flags for more detail. Usage:
e.g. set ( DBQuery.FLG_QUERY_FORCE_HINT | DBQuery.FLG_QUERY_WITH_RETURNDATA ) to param flag
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. Please see the definition
of follow flags for more detail.
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. Please see the definition
of follow flags for more detail.
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 void update(BSONObject matcher, BSONObject modifier, BSONObject hint) throws BaseException
matcher
- The matching condition, update all the documents if nullmodifier
- The updating 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.BaseException
- If error happens.public void update(BSONObject matcher, BSONObject modifier, BSONObject hint, int flag) throws BaseException
matcher
- The matching condition, update all the documents if nullmodifier
- The updating 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.flag
- the update flag, default to be 0. Please see the definition
of follow flags for more detail.
BaseException
- If error happens.public void update(DBQuery query) throws BaseException
query
- DBQuery with matching condition, updating rule and hintBaseException
- If error happens.public void update(String matcher, String modifier, String hint) throws BaseException
matcher
- The matching condition, update all the documents if nullmodifier
- The updating rule, can't be null or emptyhint
- 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 void update(String matcher, String modifier, String hint, int flag) throws BaseException
matcher
- The matching condition, update all the documents if nullmodifier
- The updating rule, can't be null or emptyhint
- 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 update flag, default to be 0. Please see the definition
of follow flags for more detail.
BaseException
- If error happens.public void upsert(BSONObject matcher, BSONObject modifier, BSONObject hint) throws BaseException
matcher
- The matching condition, update all the documents
if null(that's to say, we match all the documents)modifier
- The updating 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.BaseException
- If error happens.public void upsert(BSONObject matcher, BSONObject modifier, BSONObject hint, BSONObject setOnInsert) throws BaseException
matcher
- The matching condition, update all the documents
if null(that's to say, we match all the documents)modifier
- The updating 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.setOnInsert
- When "setOnInsert" is not a null or an empty object,
it assigns the specified values to the fields when insert.BaseException
- If error happens.public void upsert(BSONObject matcher, BSONObject modifier, BSONObject hint, BSONObject setOnInsert, int flag) throws BaseException
matcher
- The matching condition, update all the documents
if null(that's to say, we match all the documents)modifier
- The updating 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.setOnInsert
- When "setOnInsert" is not a null or an empty object,
it assigns the specified values to the fields when insert.flag
- the upsert flag, default to be 0. Please see the definition
of follow flags for more detail.
BaseException
- If error happens.Copyright © 2018. All rights reserved.