× Heads up!

Aqua Data Studio / nhilam

Follow
IDE for Relational Databases
×
anilkalshetti reported 2015-11-19T05:24:25Z  · last modified 2015-11-19T06:43:53Z

Alter Collection command shows MissingTokenException


Dev
Jenny Nishimura
JennyNishimura
QA
Tariq Rahiman
tariqrahiman
Priority Low
Complexity Unknown
Component MongoSQL
Version 17.0

Aqua Data Studio 17.0.0-rc-37
Build #: 47068
Built on: 2015-Nov-17 03:24:49 PM          

 
OS: Ubuntu 14.04
Linux (3.13.0-59-generic, amd64) / UTF-8 / en / IN / Oracle Corporation 1.8.0_40-b26
Memory: Max=704,643,072;  Total=578,813,952;  Free=226,655,184;  CPUs=8
 
Database: MongoDB 3.0.7 , MongoDB 3.0.5 , MongoDB 2.6-11
Storage Engine- MMAPv1
 
Issue: Alter Collection command shows MissingTokenException
 

Steps:
1] Open Query Analyzer(MongoJS), execute below script to create collection.
  
db.client.insert({name:"aquafold"})

Scenario A] - Alter Command - shows MissingTokenException
2]  Open Query Analyzer(SQL), execute below Alter collection command,

ALTER COLLECTION "client" CAPPED SIZE 10485760 MAX_CAP 500
GO
 

It shows below exception -             <--Issue

>[Error] Script lines: 9-10 -------------------------
 Syntax error on input SQL `ALTER COLLECTION "client" CAPPED SIZE 10485760 MAX_CAP 500`: MissingTokenException(inserted [@-1,0:0='<missing EOF>',<-1>,1:47] at MAX_CAP)
 If you want to execute MongoDB JavaScript commands, you can use the EVAL or EVAL_ARRAY command or launch a MongoJS Query Analyzer.
 To set the default syntax for MongoDB Query Analyzer, go to File > Options > Query Analyzer > MongoDB > Default Syntax.
 

Please refer screenshot- 1AlterCommand.png


Scenario B]- ADS Visual Editor- Max Number of Documents field is disabled 

3] 'client' collection is created. Right click on collection, select 'Alter Collection' option
4] In Storage Tab, Check Capped option
- Click Storage Size drop down list, Pop up is displayed.
In Pop up select Unit as Megabytes(MB) from drop down list, and enter value as 10
Click OK button. Value displayed as : 
10485760 Bytes . 
 - Click on Max Number of Documents field - textbox-  The textbox is disabled.
 <--Issue
Expected: Max Number of Documents field - textbox field should be enabled.

5] On Query Analyzer(MongoJS), execute below script to Alter collection- convert collection to capped. It works properly.

db.runCommand({"convertToCapped": "client", size: 100000,  max : 5000})
 

In above command - 'max' indicates Max Number of Documents

Please refer screenshot2.png

@Dev:
1. Issue is also observed on previous builds ADS15.0.16-1  and ADS16.0.9-6  
2. Alter Collection command  created w.r.to Issue#8735 comment

CREATE COLLECTION collection_name [ CAPPED { true | false } ] [ SIZE sizeInBytes ] [ MAX_CAP numOfDocuments ]
- Default for CAPPED is false.
- If CAPPED is true, SIZE is the maximum size in bytes for the capped collection.
- If CAPPED is false, SIZE is optional and it specifies the size to preallocate space for the collection.
- MAX_CAP is optional.  If CAPPED is true, it specifies a maximum "cap," in number of documents.

ALTER COLLECTION collection_name CAPPED SIZE sizeInBytes
- This command converts a non-capped collection to a capped collection.

Also, update the SHOW COLLECTIONS command and the TABLES catalog table to include a flag whether the collection is capped (and SIZE and MAX if you can retrieve those values).

 

2 attachments

Issue #13867

Closed
Invalid
Resolved 2015-11-19T06:40:56Z
 
 
Completion
No due date
No fixed build
No time estimate

About AquaClusters Privacy Policy Support Version - 19.0.2-4 AquaFold, Inc Copyright © 2007-2017