Perhaps incorrectly asked a question, but still.

I create a collection like this:

export const BookCollection = new MongoObservable.Collection<Book>('books'); 

But, as I understand it, the BookCollection.insert method BookCollection.insert not have a second argument.

How can I get _id ?

I tried BookCollection.insert(...).then(...) , but there’s nothing like id in general and no close.

    1 answer 1

    Since this is a rx try this:

     BookCollection.insert(book) .toPromise() .then(function(res, err) { console.log(res, err); }); 
    • Like clockwork. res is the id of the created document. - Tymur Valiiev