Adoptable Cookbooks List

Looking for a cookbook to adopt? You can now see a list of cookbooks available for adoption!
List of Adoptable Cookbooks

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

Select Badges

Select Supported Platforms


mongodb3-objects (1) Versions 0.4.5

Provides LWRP resources to manage MongoDB 3.x

cookbook 'mongodb3-objects', '~> 0.4.5'
cookbook 'mongodb3-objects', '~> 0.4.5', :supermarket
knife cookbook site install mongodb3-objects
knife cookbook site download mongodb3-objects
Quality 56%


Cookbook Version


This cookbook is a wrapper over the mongodb3 cookbook. It contains LWRP resources to create: * users * replica sets * sharding database * sharding collection * replica sets for config servers * routing servers (mongos)



Tested on Centos 6 and 7, but could work on any other Linux.




Creates administrator account. If authentication mechanism was enabled in configuration already, only request from localhost to create administrator user will work. See this and this. Login is mandatory.

  • login - Login name for administrator account
  • password - Password for administrator account


Creates a user account in specified database with specified role. In MongoDB database can be absent till some data is written. Users are stored in 'admin' database. To choose appropriate role see built-in roles.

  • login - Login name for administrator account
  • password - Password for administrator account
  • roles - Roles to assign
  • database - User database


Creates a replica set with specified members (usually 3).

  • members - Replica set members in format [{"host": "host1:port"}, {"host": "host2:port", "priority": 2}]
  • config_server - Set config server settings for replica set


Add shard to a sharding cluster. This is essentially addShard command. The host parameter can be in any of the following forms: - [hostname] - [hostname]:[port] - [replica-set-name]/[hostname] - [replica-set-name]/[hostname]:port

  • shard_endpoint - The hostname of either a standalone database instance or of a replica set. Include the port number if the instance is running on a non-standard port. Include the replica set name if the instance is a replica set.


Configure sharding for database. This adds enableSharding parameter to database configuration.

  • database - Database name


Enables a collection for sharding and allows MongoDB to begin distributing data among shards. You must run mongodb_sharding_database on a database before using this.

  • collection - Collection name
  • shard_key - The index specification document to use as the shard key. The index must exist prior to the shardCollection command, unless the collection is empty. If the collection is empty, in which case MongoDB creates the index prior to sharding the collection. New in version 2.4: The key may be in the form { field : "hashed" }, which will use the specified field as a hashed shard key.


Enables index for collection

  • collection - Collection name
  • database - Database name
  • index - Index description


If MongoDB is already installed just use

include_recipe 'mongodb3-objects::default'

to install mongo and bson gems. After that LWRPs can be used.

To install standalone MongoDB use

include_recipe 'mongodb3-objects::standalone'

Also you may see examples in fixture cookbook: test/fixtures/cookbooks/mongotest/recipes.


  1. Fork the repository on Github
  2. Create a named feature branch (like add_component_x)
  3. Write your change
  4. Write tests for your change (if applicable)
  5. Run the tests, ensuring they all pass
  6. Submit a Pull Request using Github

License & Authors

Copyright:: 2016-2017 Parallels International GmbH

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
See the License for the specific language governing permissions and
limitations under the License.

Dependent cookbooks

mongo_chef_gem >= 0.0.0
mongodb3 >= 0.0.0

Contingent cookbooks

There are no cookbooks that are contingent upon this one.

0.4.5 (Jan 18, 2017)

  • Release to community

0.4.4 (Sep 13, 2016)

  • Add mongodb_collection_index LWRP

0.4.3 (Sep 13, 2016)

  • Update logging to warn

0.4.0 (May 30, 2016)

  • Change LWRP mongo_replicaset

0.3.1 (May 19, 2016)

  • Now resources fail hard if creation didn't succeed.

0.3.0 (May 18, 2016)

  • Add support to add replica set through mongodb_shard resource. This breaks backward compatibility for this resource!
  • Add Centos 7 to converge and verify platforms.

0.2.2 (April 14, 2016)

  • Fix roles for mongodb_admin resource.

0.2.0 (April 12, 2016)

  • Add replica set LWRP with tests;
  • Add sharding LWRPs.

0.1.0 (March 24, 2016)

  • Initial cookbook.

Collaborator Number Metric

0.4.5 failed this metric

Failure: Cookbook has 1 collaborators. A cookbook must have at least 2 collaborators to pass this metric.

Contributing File Metric

0.4.5 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of, and your repo must contain a file

Foodcritic Metric

0.4.5 failed this metric

FC008: Generated cookbook metadata needs updating: mongodb3-objects/metadata.rb:2
FC066: Ensure chef_version is set in metadata: mongodb3-objects/metadata.rb:1
FC069: Ensure standardized license defined in metadata: mongodb3-objects/metadata.rb:1
FC108: Resource should not define a property named 'name': mongodb3-objects/resources/mongodb_collection_index.rb:22
Run with Foodcritic Version 12.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any

License Metric

0.4.5 passed this metric

No Binaries Metric

0.4.5 passed this metric

Publish Metric

0.4.5 passed this metric

Supported Platforms Metric

0.4.5 passed this metric

Testing File Metric

0.4.5 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of, and your repo must contain a file

Version Tag Metric

0.4.5 passed this metric