mongodb: using "if-empty" makes it cleaner.
							parent
							
								
									315896c857
								
							
						
					
					
						commit
						08aa100eb7
					
				| 
						 | 
					@ -242,7 +242,7 @@ M: mdb-cursor find
 | 
				
			||||||
: find-one ( mdb-query-msg -- result/f )
 | 
					: find-one ( mdb-query-msg -- result/f )
 | 
				
			||||||
    fix-query-collection 
 | 
					    fix-query-collection 
 | 
				
			||||||
    1 >>return# send-query-plain objects>>
 | 
					    1 >>return# send-query-plain objects>>
 | 
				
			||||||
    dup empty? [ drop f ] [ first ] if ;
 | 
					    [ f ] [ first ] if-empty ;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
: count ( mdb-query-msg -- result )
 | 
					: count ( mdb-query-msg -- result )
 | 
				
			||||||
    [ count-cmd make-cmd ] dip
 | 
					    [ count-cmd make-cmd ] dip
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -269,7 +269,7 @@ M: gridfs-input-stream stream-element-type drop +byte+ ;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
M: gridfs-input-stream stream-read ( n stream -- seq/f )
 | 
					M: gridfs-input-stream stream-read ( n stream -- seq/f )
 | 
				
			||||||
    over <byte-vector> [ (stream-read) ] [ ] bi
 | 
					    over <byte-vector> [ (stream-read) ] [ ] bi
 | 
				
			||||||
    dup empty? [ drop f ] [ >byte-array ] if ;
 | 
					    [ f ] [ >byte-array ] if-empty ;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
M: gridfs-input-stream stream-read-partial ( n stream -- seq/f )
 | 
					M: gridfs-input-stream stream-read-partial ( n stream -- seq/f )
 | 
				
			||||||
    (stream-read-partial) ;
 | 
					    (stream-read-partial) ;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue