Domanda

The document of Meteor says that it use STRING as the _id by default. What's the meaning behind it? What if I write a script to import a huge csv file but would like to give each of them a random string, what can I do?

È stato utile?

Soluzione

There's been quite a bit of discussion about why Meteor uses string IDs instead of ObjectIDs, but it basically boils down to the fact that generating ObjectIDs is a lot harder on the client.

The string id generation is implemented as Random.id() in Meteor. So if you're importing the CSV in Javascript in a Meteor process, just use that.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top