public static Collection loadDocuments()

in bulkimport/src/main/java/com/microsoft/azure/documentdb/bulkimport/Main.java [190:212]


        public static Collection<String> loadDocuments(int numberOfDocuments, PartitionKeyDefinition partitionKeyDefinition) {

            Preconditions.checkArgument(partitionKeyDefinition != null &&
                    partitionKeyDefinition.getPaths().size() > 0, "there is no partition key definition");

            Collection<String> partitionKeyPath = partitionKeyDefinition.getPaths();
            Preconditions.checkArgument(partitionKeyPath.size() == 1,
                    "the command line benchmark tool only support simple partition key path");

            String partitionKeyName = partitionKeyPath.iterator().next().replaceFirst("^/", "");

            // the size of each document is approximately 1KB

            ArrayList<String> allDocs = new ArrayList<>(numberOfDocuments);

            // return documents to be bulk imported
            // if you are reading documents from disk you can change this to read documents from disk
            return IntStream.range(0, numberOfDocuments).mapToObj(i ->
            {
                String partitionKeyValue = UUID.randomUUID().toString();
                return generateDocument(partitionKeyName, partitionKeyValue);
            }).collect(Collectors.toCollection(() -> allDocs));
        }