Uploads data to a MongoDB collection, optionally creating a geospatial index. For non-geo collections, stores a metadata document preserving column order (used by [mdb_collection_pull()] to restore structure).
Usage
mdb_collection_push(
data = NULL,
connection_string = NULL,
collection_name = NULL,
db_name = NULL,
geo = FALSE
)Arguments
- data
A data frame or sf object to upload.
- connection_string
Character. MongoDB connection string.
- collection_name
Character. Name of the MongoDB collection.
- db_name
Character. Name of the MongoDB database.
- geo
Logical. Whether to create a 2dsphere index on the geometry field. Default is FALSE. When TRUE, the collection is dropped entirely before reinserting to avoid index conflicts with complex geometries.