Every line of 'get document by id' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.
24 find(document) { 25 return this._get(document.id); 26 }
22 getById(documentId) { 23 return this.http 24 .get(this.getIdRoute(documentId)); 25 }
63 get id(): string { 64 const ref = this._ref.get(); 65 return ref ? ref.id : undefined; 66 }
209 function get_manage_document(id){ 210 return manage_table_documents.find(function(d){ return d.id === id; }); 211 }
58 private fetchDocument(id: string): Observable { 59 const requestPath = `${DOC_CONTENT_URL_PREFIX}${id}.json`; 60 const subject = new AsyncSubject(); 61 62 this.logger.log('fetching document from', requestPath); 63 this.http 64 .get(requestPath, {responseType: 'json'}) 65 .do(data => { 66 if (!data || typeof data !== 'object') { 67 this.logger.log('received invalid data:', data); 68 throw Error('Invalid data'); 69 } 70 }) 71 .catch((error: HttpErrorResponse) => { 72 return error.status === 404 ? this.getFileNotFoundDoc(id) : this.getErrorDoc(id, error); 73 }) 74 .subscribe(subject); 75 76 return subject.asObservable(); 77 }
55 private fetchDocument(id: string): Observable { 56 const requestPath = `${DOC_CONTENT_URL_PREFIX}${id}.json`; 57 const subject = new AsyncSubject(); 58 59 this.logger.log('fetching document from', requestPath); 60 this.http 61 .get(requestPath, {responseType: 'json'}) 62 .pipe( 63 tap(data => { 64 if (!data || typeof data !== 'object') { 65 this.logger.log('received invalid data:', data); 66 throw Error('Invalid data'); 67 } 68 }), 69 catchError((error: HttpErrorResponse) => { 70 return error.status === 404 ? this.getFileNotFoundDoc(id) : this.getErrorDoc(id, error); 71 }), 72 ) 73 .subscribe(subject); 74 75 return subject.asObservable(); 76 }
55 get(id: number): T { 56 return this._ids[id] 57 }
10 get(id) { 11 return this.data[id] 12 }
36 export async function getById (id) { 37 const oid = ObjectId(id) 38 const session = await sessions().findOne({ 39 _id: oid, 40 }) 41 session && processItem(session) 42 return session 43 }
35 get(id: string) { 36 return this._items.get(id) || null; 37 }