Collection methods

supports a subset of the MongoDB collection methods.

The collection methods are run on a JSON collection or a relational table. The syntax for collection methods in the mongo shell is db.collection_name.collection_method(), where db refers to the current database, collection_name is the name of the JSON collection or relational table, collection_method is the MongoDB collection method. For example, db.cartype.count() determines the number of documents that are contained in the cartype collection.

Table 1. Supported collection methods
Collection method JSON collections Relational tables Details
aggregate No No  
count Yes Yes  
createIndex Yes Yes

For more information, see Index creation.

dataSize Yes No  
distinct Yes Yes  
drop Yes Yes  
dropIndex Yes Yes  
dropIndexes Yes No  
ensureIndex Yes Yes

For more information, see Index creation.

find Yes Yes You can use the $nativeCursor query modifier with the addSpecial function.
findAndModify Yes Yes

For relational tables, findAndModify is supported only for tables that have a primary key. This method is not support sharded data.

findOne Yes Yes  
getIndexes Yes No  
getShardDistribution No No  
getShardVersion No No  
getIndexStats No No  
group No No  
indexStats No No  
insert Yes Yes  
isCapped Yes Yes This command returns false because capped collections are not supported in .
mapReduce No No  
reIndex No No  
remove Yes Yes The justOne option is not supported. This command deletes all documents that match the query criteria.
renameCollection No No  
save Yes No  
stats Yes No  
storageSize Yes No  
totalSize Yes No  
update Yes Yes The multi option is supported for JSON collections if in the wire listener properties file. For relational tables, the multi-parameter is ignored and all documents that meet the query criteria are updated. If, all documents that match the query criteria are updated.
validate No No  

For more information about the MongoDB features, see

Copyright© 2018 HCL Technologies Limited