added >multi word, removed unused singletons, fixed tuple example in docs
							parent
							
								
									e42479b257
								
							
						
					
					
						commit
						7295a04519
					
				| 
						 | 
				
			
			@ -5,6 +5,7 @@ mongodb.cmd mongodb.connection mongodb.msg namespaces parser
 | 
			
		|||
prettyprint prettyprint.custom prettyprint.sections sequences
 | 
			
		||||
sets splitting strings ;
 | 
			
		||||
FROM: ascii => ascii? ;
 | 
			
		||||
FROM: math.bitwise => set-bit ;
 | 
			
		||||
IN: mongodb.driver
 | 
			
		||||
 | 
			
		||||
TUPLE: mdb-pool < pool mdb ;
 | 
			
		||||
| 
						 | 
				
			
			@ -278,7 +279,10 @@ PRIVATE>
 | 
			
		|||
    [ check-collection ] 2dip <mdb-update-msg> ;
 | 
			
		||||
 | 
			
		||||
: >upsert ( mdb-update-msg -- mdb-update-msg )
 | 
			
		||||
    1 >>upsert? ; 
 | 
			
		||||
    [ 0 set-bit ] change-update-flags ;
 | 
			
		||||
 | 
			
		||||
: >multi ( mdb-update-msg -- mdb-update-msg )
 | 
			
		||||
    [ 1 set-bit ] change-update-flags ;
 | 
			
		||||
 | 
			
		||||
: update ( mdb-update-msg -- )
 | 
			
		||||
    send-message-check-error ;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -20,7 +20,7 @@ ARTICLE: "mongodb" "MongoDB factor integration"
 | 
			
		|||
  "person \"persons\" { } { $[ \"ageIdx\" [ \"age\" asc ] key-spec <tuple-index> ] } define-persistent "
 | 
			
		||||
  "\"db\" \"127.0.0.1\" 27017 <mdb>"
 | 
			
		||||
  "person new \"Alfred\" >>name 57 >>age"
 | 
			
		||||
  "'[ _ save-tuple person new 57 >>age select-tuple ] with-db"
 | 
			
		||||
  "'[ person ensure-table _ save-tuple person new 57 >>age select-tuple ] with-db"
 | 
			
		||||
  "" }
 | 
			
		||||
;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -38,7 +38,7 @@ TUPLE: mdb-insert-msg < mdb-msg
 | 
			
		|||
 | 
			
		||||
TUPLE: mdb-update-msg < mdb-msg
 | 
			
		||||
    { collection string }
 | 
			
		||||
    { upsert? integer initial: 0 }
 | 
			
		||||
    { update-flags integer initial: 0 }
 | 
			
		||||
    { selector assoc }
 | 
			
		||||
    { object assoc } ;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -120,7 +120,7 @@ PRIVATE>
 | 
			
		|||
        { 
 | 
			
		||||
            [ flags>> write-int32 ]
 | 
			
		||||
            [ collection>> write-cstring ]
 | 
			
		||||
            [ upsert?>> write-int32 ]
 | 
			
		||||
            [ update-flags>> write-int32 ]
 | 
			
		||||
            [ selector>> assoc>stream ]
 | 
			
		||||
            [ object>> assoc>stream ]
 | 
			
		||||
        } cleave
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -7,8 +7,6 @@ FROM: mongodb.tuple.persistent => assoc>tuple ;
 | 
			
		|||
 | 
			
		||||
IN: mongodb.tuple
 | 
			
		||||
 | 
			
		||||
SINGLETONS: +fieldindex+ +compoundindex+ +deepindex+ +unique+ ;
 | 
			
		||||
 | 
			
		||||
SYNTAX: MDBTUPLE:
 | 
			
		||||
    parse-tuple-definition
 | 
			
		||||
    mdb-check-slots
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue