Comments (2)
@Bob565656 thanks for reporting!
It seems that we just need varchar(24)
? ObjectID
is 12 byte length.
https://docs.mongodb.com/manual/reference/method/ObjectId/#ObjectId
from momy.
If the _id is treated as a string, the CREATE TABLE command will use a VARCHAR(255) which is too large for a MYSQL string index if using collation of utf8mb4_general_ci
Fix for this was to change the type defines to VARCHAR(50) instead of VARCHAR(255)
Future releases should allow variable VARCHAR size in the JSON
Stack trace
9 Mar 21:07:05 - Connect to MySQL... 9 Mar 21:07:05 - { Error: ER_TOO_LONG_KEY: Specified key was too long; max key length is 767 bytes at Query.Sequence._packetToError (/usr/local/lib/node_modules/momy/node_modules/mysql/lib/protocol/sequences/Sequence.js:52:14) at Query.ErrorPacket (/usr/local/lib/node_modules/momy/node_modules/mysql/lib/protocol/sequences/Query.js:77:18) at Protocol._parsePacket (/usr/local/lib/node_modules/momy/node_modules/mysql/lib/protocol/Protocol.js:280:23) at Parser.write (/usr/local/lib/node_modules/momy/node_modules/mysql/lib/protocol/Parser.js:75:12) at Protocol.write (/usr/local/lib/node_modules/momy/node_modules/mysql/lib/protocol/Protocol.js:39:16) at Socket.<anonymous> (/usr/local/lib/node_modules/momy/node_modules/mysql/lib/Connection.js:103:28) at emitOne (events.js:96:13) at Socket.emit (events.js:189:7) at readableAddChunk (_stream_readable.js:176:18) at Socket.Readable.push (_stream_readable.js:134:10) -------------------- at Protocol._enqueue (/usr/local/lib/node_modules/momy/node_modules/mysql/lib/protocol/Protocol.js:141:48) at Connection.query (/usr/local/lib/node_modules/momy/node_modules/mysql/lib/Connection.js:208:25) at Promise (/usr/local/lib/node_modules/momy/lib/mysql.js:177:10) at MySQL.query (/usr/local/lib/node_modules/momy/lib/mysql.js:175:12) at query.then.then (/usr/local/lib/node_modules/momy/lib/mysql.js:116:24) at process._tickCallback (internal/process/next_tick.js:103:7) code: 'ER_TOO_LONG_KEY', errno: 1071, sqlState: '42000', index: 1 }
In my case, i had change the collation of MySQL database to utf8_swedish_ci
, and it work.
After read some articles, some collation have different maximum for storing key.
from momy.
Related Issues (20)
- MongoDB cannot login, always Authentication failed HOT 10
- Is this supposed to support for array? HOT 5
- No more documents in tailed cursor HOT 2
- Error if datetime is type object HOT 5
- ns field has bson.D value that is not string or valid MongoDb HOT 2
- ER_PARSE_ERROR HOT 2
- Error When Streaming HOT 1
- Replica set with data HOT 1
- operation exceeded time limit
- dynamic addition of collections to sync HOT 1
- migrate into two database
- I want Mysql to mysql with live transfer
- datetime is null in mysql HOT 2
- First record empty and data not synced HOT 2
- Data not updated in MySQL after chagne in MongoDB HOT 3
- Custom converters or filters HOT 3
- Todo: code coverage HOT 1
- Todo: more tests
- Tests on Travis fail HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from momy.