Parse.com 將於 2017 .01.28 結束服務,伴隨著提供了一些 Migration 方案,跟自家 Parse Server open source
ParsePlatform/parse-server: Parse-compatible API server module for Node/Express
https://github.com/ParsePlatform/parse-server
Parse.com ObjectId unique id 產生方法
從 Parse Server 中可以看到 Parse Server 裡面產生 ObjectId 的方式,是使用 random char 的方式產生長度 10 的 objectId 。
// Returns a string that's usable as an object id.parse-server/RestWrite.js at master · ParsePlatform/parse-server
// Probably unique. Good enough? Probably!
function newObjectId() {
var chars = ('ABCDEFGHIJKLMNOPQRSTUVWXYZ' +
'abcdefghijklmnopqrstuvwxyz' +
'0123456789');
var objectId = '';
for (var i = 0; i < 10; ++i) {
objectId += chars[Math.floor(Math.random() * chars.length)];
}
return objectId;
}
https://github.com/ParsePlatform/parse-server/blob/master/RestWrite.js#L707
Moving On
http://blog.parse.com/announcements/moving-on/
Introducing Parse Server and the Database Migration Tool
http://blog.parse.com/announcements/introducing-parse-server-and-the-database-migration-tool/
相關連結
[tech_note] hackpad 的 unique padid 產生方式 / etherpad 與 appjet - peicheng note
http://peichengnote.blogspot.com/2015/10/technote-hackpad-unique-padid-etherpad.html
沒有留言:
張貼留言