Skip to content

AttributeError: 'MongoStore' object has no attribute 'options' when using Mongodb store #257

@bfagundez

Description

@bfagundez

I get the following exception:

AttributeError: 'MongoStore' object has no attribute 'options'

When using a MongoDB store.
The problem seems to be on the file workspace.py:

def browser(self, cube, locale=None, identity=None):
        """Returns a browser for `cube`."""

        # TODO: bring back the localization
        # model = self.localized_model(locale)

        if isinstance(cube, compat.string_type):
            cube = self.cube(cube, identity=identity)

        locale = locale or cube.locale
        if isinstance(cube.store, compat.string_type):
            store_name = cube.store or "default"
            store = self.get_store(store_name)
            store_type = self.store_infos[store_name][0]
            store_info = self.store_infos[store_name][1]
        elif cube.store:
            store = cube.store
            store_info = store.options or {}
        else:
            store = self.get_store("default")
            # [!] here it breaks [!]
            store_info = store.options or {} 

I'm using cubes 1.0, MongoDB 2.6.6 on OSX Yosemite.

slicer.ini:

[store]
type:mongo
url:mongodb://127.0.0.1:27017/
database: mydatabase
collection: cases

[workspace]
log_level: debug

[models]
main: model.json

[server]
host: localhost
port: 5001
reload: yes
prettyprint: yes

model.js:

{
    "dimensions": [
        {
         "name":"case",
         "levels": [
                {
                    "name":"RMA_Status__c",
                    "label":"RMA Status",
                    "attributes": ["RMA_Status__c"]
                }
            ]
        },
        {"name":"Closed_Date__c", "role": "time"},
        {"name":"Created_Date__c", "role": "time"}
    ],
    "cubes": [
        {
            "name": "cases",
            "dimensions": ["case", "Closed_Date__c","Created_Date__c" ]
        }
    ]
}

Data structure in Mongo collection:

[{
  "_id": ObjectId("54baa0ea11979b47164c4618"),
  "Product__c": null,
  "SuppliedCompany": null,
  "Priority": "Medium",
  "Today_s_Date__c": "",
  "Created_Date__c": "06/03/14",
  "Status": "Closed",
  "Closed_Date__c": "08/15/14",
  "Description": "51-B4-35-70-CD-BA-91-87-42-E1-90-B0-0D-ED-CE-E1",
  "ClosedDate": "01/03/15",
  "IsEscalated": false,
  "SuppliedPhone": null,
  "ContactId": "003j0000006fPktAAE",
  "Reason": null,
  "Bug_Number_s__c": null,
  "IsDeleted": false,
  "SuppliedName": "D4-1D-8C-D9-8F-00-B2-04-E9-80-09-98-EC-F8-42-7E",
  "Last_Updated_Date__c": "07/18/14",
  "SuppliedEmail": null,
  "AssetId": null,
  "PotentialLiability__c": null,
  "Number_of_Days_Open__c": "72",
  "Product_Name__c": null,
  "Origin": "Email to PSGsupport",
  "CC_List__c": null,
  "EngineeringReqNumber__c": null,
  "RMA_Status__c": "No RMA",
  "IsClosed": true,
  "Product_Name2__c": null,
  "AccountId": "001j000000DCt6rAAD",
  "Id": "500j0000001OWbHAAW",
  "Subject": "EB-D1-9A-A4-FC-36-14-6A-58-FE-D4-7A-29-4D-3B-4B"
},...]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions