You can insert a batch array of hashes using the ruby mongo driver’s insert method. From any Mongoid class, you can call collection to access it.
batch = [{:name => "mongodb"}, {:name => "mongoid"}]
Article.collection.insert(batch)
More Related Contents:
- MongoDB: count the number of items in an array
- Difference between “id” and “_id” fields in MongoDB
- How to deal with the timezone issue when storing dates in utc using mongod?
- Does MongoDB’s $in clause guarantee order
- Authentication failure while trying to save to mongodb
- Possibility of duplicate Mongo ObjectId’s being generated in two different collections?
- How to change the type of a field?
- MongoDB logging all queries
- Return only matched sub-document elements within a nested array
- Querying internal array size in MongoDB
- How to delete N numbers of documents in mongodb
- How do I query for distinct values in Mongoose?
- How to insert an element to MongoDB internal list?
- Hierarchical queries with Mongo using $graphLookup
- Remove embedded document in a nested array of documents
- Find all documents within last n days
- How to ignore nulls while unmarshalling a MongoDB document?
- How to use mongoimport to import CSV files?
- Mongodb query specific month|year not date
- Remove Duplicates from MongoDB
- Spring data MongoDb: MappingMongoConverter remove _class
- How to access overall document count during arithmetic aggregation expression
- How to find min value in mongodb
- Does MongoDB support floating point types?
- Fuzzy Searching with Mongodb?
- Sum in nested document MongoDB
- How to do pagination using range queries in MongoDB?
- MongoDB Single Document size limit is 16MB
- mongodb aggregate query isn’t returning proper sum on using $sum
- MongoDB aggregate by field exists