use of io.lumeer.storage.mongodb.model.common.MorphiaEntity.ID in project engine by Lumeer.
the class MorphiaDocumentDao method createDocuments.
@Override
public List<Document> createDocuments(final List<Document> documents) {
List<org.bson.Document> bsonDocuments = documents.stream().map(doc -> new MorphiaDocument(doc).toBsonDocument()).collect(Collectors.toList());
database.getCollection(databaseCollection()).insertMany(bsonDocuments);
for (int i = 0; i < documents.size(); i++) {
documents.get(i).setId(bsonDocuments.get(i).getObjectId(ID).toHexString());
}
return documents;
}
Aggregations