Проблемы с обратным вызовом Meteor collection.insert
Согласно метеоритной документации ....
collection.insert(doc, [callback])
callback Function
Optional. If present, called with an error object as the first argument and the _id as the second.
... потом позже ...
On the server, if you don't provide a callback, then insert blocks until the database acknowledges the write, or throws an exception if something went wrong. If you do provide a callback, insert returns immediately. Once the insert completes (or fails), the callback is called with error and result arguments, same as for methods.
Что это, ошибка и _id или ошибка и результат? У меня есть Meteor.methods, которые корректно запускают свои обратные вызовы с ошибкой, результат доступен для области.
Я просто не могу заставить обратный вызов работать правильно на collection.insert (doc, [callback])
В любом случае я не могу получить свой обратный вызов для регистрации чего-либо?
<code>function insertPost(args) { this.unblock; if(args) { post_text = args.text.slice(0,140); var ts = Date.now(); Posts.insert({ post: post_text, created: ts }, function(error, _id){ // or try function(error, result) and still get nothing // console.log('result: ' + result); console.log('error: ' + error); console.log('_id: ' + _id); //this._id doesn't work either }); } return; } </code>
Что я делаю неправильно? Я встаю с 2 часов утра, кодирую ... 6 часов вечера моего часового пояса ... Я размыта, так что я могу (возможно) упустить что-то совершенно очевидное.
ура штивать