@@ -808,7 +808,10 @@ def create_collection(self,
808808 shard_fields = None ,
809809 shard_count = None ,
810810 index_bucket_count = None ,
811- replication_factor = None ):
811+ replication_factor = None ,
812+ shard_like = None ,
813+ sync_replication = None ,
814+ enforce_replication_factor = None ):
812815 """Create a new collection.
813816
814817 :param name: Collection name.
@@ -863,6 +866,19 @@ def create_collection(self,
863866 every write to the master is copied to all slaves before operation
864867 is reported successful).
865868 :type replication_factor: int
869+ :param shard_like: Name of prototype collection whose sharding
870+ specifics are imitated. Prototype collections cannot be dropped
871+ before imitating collections. Applies to enterprise version of
872+ ArangoDB only.
873+ :type shard_like: str | unicode
874+ :param sync_replication: If set to True, server reports success only
875+ when collection is created in all replicas. You can set this to
876+ False for faster server response, and if full replication is not a
877+ concern.
878+ :type sync_replication: bool
879+ :param enforce_replication_factor: Check if there are enough replicas
880+ available at creation time, or halt the operation.
881+ :type enforce_replication_factor: bool
866882 :return: Standard collection API wrapper.
867883 :rtype: arango.collection.StandardCollection
868884 :raise arango.exceptions.CollectionCreateError: If create fails.
@@ -879,14 +895,9 @@ def create_collection(self,
879895 'doCompact' : compact ,
880896 'isSystem' : system ,
881897 'isVolatile' : volatile ,
882- 'keyOptions' : key_options
898+ 'keyOptions' : key_options ,
899+ 'type' : 3 if edge else 2
883900 }
884-
885- if edge :
886- data ['type' ] = 3
887- else :
888- data ['type' ] = 2
889-
890901 if journal_size is not None :
891902 data ['journalSize' ] = journal_size
892903 if shard_count is not None :
@@ -897,10 +908,19 @@ def create_collection(self,
897908 data ['indexBuckets' ] = index_bucket_count
898909 if replication_factor is not None :
899910 data ['replicationFactor' ] = replication_factor
911+ if shard_like is not None :
912+ data ['distributeShardsLike' ] = shard_like
913+
914+ params = {}
915+ if sync_replication is not None :
916+ params ['waitForSyncReplication' ] = sync_replication
917+ if enforce_replication_factor is not None :
918+ params ['enforceReplicationFactor' ] = enforce_replication_factor
900919
901920 request = Request (
902921 method = 'post' ,
903922 endpoint = '/_api/collection' ,
923+ params = params ,
904924 data = data
905925 )
906926
0 commit comments