why very slow?
schema
export const AVFile = {
className: "AVFile",
fields: {
mime_type: {type: "String"},
key: {type: "String"},
name: {type: "String"},
provider: {type: "String"},
owner: {type: "String"},
size: {type: "Number"},
url: {type: "String"},
},
indexes: {
_AVFile_ownerIndex: {owner: 1},
},
classLevelPermissions: {
find: {},
count: {},
get: {},
update: {},
create: {},
delete: {},
protectedFields: {},
},
}
indexes: {
_AVFile_ownerIndex: {owner: 1},
_AVFile_createdAtIndex: {_created_at: 1},
_AVFile_updatedAtIndex: {_updated_at: 1},
_AVFile_objectId: {objectId: 1},
},
Failed to run migrations: Error during update of schema for type AVFile: ParseError: 102 Field _created_at does not exist, cannot add index.
I use parse server 6.4.0 parse-dashboard 5.3.0
export const AVFile = {
className: "AVFile",
fields: {
mime_type: {type: "String"},
key: {type: "String"},
name: {type: "String"},
provider: {type: "String"},
owner: {type: "String"},
size: {type: "Number"},
url: {type: "String"},
},
indexes: {
AVFile_ownerIndex: {owner: 1},
AVFile_createdAtIndex: {_created_at: 1},
AVFile_updatedAtIndex: {_updated_at: 1},
},
classLevelPermissions: {
find: {},
count: {},
get: {},
update: {},
create: {},
delete: {},
protectedFields: {},
},
}
[TS] error: Failed to run migrations: Error during update of schema for type AVFile: ParseError: 102 Field _created_at does not exist, cannot add index.
why cannot create index of _created_at ?
Error says:
Field _created_at does not exist
Are you sure this field exist?
I am sure. ervery object has _created_at, _updated_at, _id
What is your migration code
export const AVFile = {
className: "AVFile",
fields: {
mime_type: {type: "String"},
key: {type: "String"},
name: {type: "String"},
provider: {type: "String"},
owner: {type: "String"},
size: {type: "Number"},
url: {type: "String"},
},
indexes: {
AVFile_ownerIndex: {owner: 1},
AVFile_createdAtIndex: {_created_at: 1},
AVFile_updatedAtIndex: {_updated_at: 1},
},
classLevelPermissions: {
find: {},
count: {},
get: {},
update: {},
create: {},
delete: {},
protectedFields: {},
},
}
schema: {
definitions: [AVFile],
lockSchemas: false,
strict: true,
recreateModifiedFields: true,
deleteExtraFields: true,
},
verbose: false,
This is a json not a code
Can you try this
AVFile_createdAtIndex: {createdAt: 1}
createdAt:‘date’
AVFile_createdAtIndex: { createdAt: 1},
use this can work
[TS] Node app is running on port: 1337
[TS] info: Running Migrations
[TS] info: Running Migrations Completed
but in mongodb, there is no createdAt filed in it
Then connect direct the Db and run this code
db.getCollection('AVFile').CreateIndex({_created_at:1})
Yes, that’s work fine. I meant to create the _created_at index when defining the schema in the code.
I think the first one you should delete the AVFile Schema and after you should run the migration code, did you try?
I have try, but not work. mybe clear all data of db first ?
Which one didnt work _created_ad ?