Actually, I just started to develop in the world of Angular Meteor, and here I have such a setup (code on the client side):

addBook() { BookCollection.insert( this.book , ( err , insertedBook_id )=> { this.book_saved = true; console.log( insertedBook_id ); //MdfQRZZiBvw7EjFZA console.log( BookCollection.find( { _id : insertedBook_id } ) .fetch() // == [] ?????? ); //this.router.navigate(['/book', insertedBook_id]); } ); } 

I doubt that this is because I do not handle the error, but it does not arise ... In general, I will be extremely grateful for the advice =)

PS There is a suspicion that this is due to the fact that this is the first item in the collection (the collection is generally empty, but after a few seconds there is exactly a record in the database).

PSS I tried `BookCollection.find (). Fetch () // == [], that is, it’s not added at all.

 console.log(err) //== undefined 
  • What are you pulling out an object for after insert? - C.Raf.T
  • Are you sure there is no error in err? - Alexandr
  • I want to generate a link to the created book. There the line is commented out, but when I turn to that page, there is no book yet ... - Tymur Valiiev

0