译文:
这本书将专注于MongoDB的功能性。因此,我们将依赖MongoDB的shell。作为一个管理工具,shell的学习是非常有用的,你的代码将使用MongoDB的驱动程序。
有关DongoDB你第一个需要了解的是:驱动程序。MongoDB有各种不同语言的官方驱动。你可以把这些驱动理解为你可能已经非常了解的其它各种数据库的驱动器。在这些驱动器上,开发社区已经建立了更多的语言/框架库。例如,NoRM是一个实现LINQ的C#库,MongoMaper是一个ActiveRecord-friendly 的ruby库。你可以选择直接使用MongoDB核心驱动或者一些更高级别的库。我指出这些的原因是因为很多新接触MongoDB的人对于为什么同时存在官方驱动和社区驱动感到很混乱-前者更多的关注于MongoDB核心的通信/连通性,后者更多的关注于语言和框架的特定实现。
读到这,我鼓励你们把我的示例复制到你自已的MongoDB上,这样可以使你发现问题。运行MongoDB非常的简单,我们用几分钟把事情解决。
1 根据你的系统去官网下载适当的二进制文件,你可以选择32位或64位。
2 解压归档文件并进入bin子目录。不要直接运行,mongodb是一个服务器进程而mongo是一个客户端的shell-我们将在这两个可
执行花费大量的时间。
3 在bin目录下建立一个mongodb.config文件
4 在mongodb.config文件下添加一行dbpath=PATH_TO_WHERE_YOU_WANT_TO_STORE_YOUR_DATABASE_,例如,在windows
下你可能是dbpath=c:\mongodb\data, 在linux下你可能是dbpath=/etc/mongodb/data。
5 确保你指定的目录dbpath存在
6 使用--config /path/to/your/mongodb.config参数启动mongod
Windows用户示例:如果你把下载文件解压到c:\mongodb\ 并且你创建了c:\mongodb\data\ 然后在c:\mongodb\bin\mongodb.config
你指定了dbpath=c:\mongodb\data\,你就可以使用以下命令启动mongod:c:\mongodb\bin\mongod --config c:\mongodb.config。
希望你的MongoDB运行起来。如果你收到错误信息,仔细的阅读输入信息-服务器可非常不错的解释发生了什么错误。
现在你可以运行mongo(没有d)为你的服务器连接一个shell。尝试输入db.version()来确保所有的事情运行正常。希望你看到你安装的版本号。
原文:
Most of this book will focus on core MongoDB functionality. We'll therefore rely on the MongoDB shell. While the shell is useful to learn as well as being a useful administrative tool, your code will use a MongoDB driver.
This does bring up the first thing you should know about MongoDB: its drivers. MongoDB has a number of official drivers for various languages. These drivers can be thought of as the various database drivers you are probably already familiar with. On top of these drivers, the development community has built more language/framework-specific libraries. For example, NoRM is a C# library which implements LINQ, and MongoMapper is a Ruby library which is ActiveRecord-friendly. Whether you choose to program directly against the core MongoDB drivers or some higher-level library is up to you. I point this out only because many people new to MongoDB are confused as to why there are both official drivers and community libraries - the former generally focuses on core communication/connectivity with MongoDB and the latter with more language and framework specific implementations.
As you read through this, I encourage you to play with MongoDB to replicate what I demon-strate as well as to explore questions that might come up on your own. It's easy to get up and running with MongoDB, so let's take a few minutes now to set things up.
1. Head over to the official download page and grab the binaries from the first row (the recommended stable version) for your operating system of choice. For development purposes, you can pick either 32-bit or 64-bit.
2. Extract the archive (wherever you want) and navigate to the bin subfolder. Don't execute anything just yet, but know that mongod is the server process and mongo is the client shell- these are the two executables we'll be spending most of our time with.
3. Create a new text file in the bin subfolder named mongodb.config
4. Add a single line to your mongodb.config: dbpath=PATH_TO_WHERE_YOU_WANT_TO_STORE_YOUR_DATABASE_F
. For example, on Windows you might do dbpath=c:\mongodb\data and on Linux you might do dbpath=/etc/mongo/data.
5. Make sure the dbpath you specified exists
6. Launch mongod with the --config /path/to/your/mongodb.config parameter.
As an example for Windows users, if you extracted the downloaded file to c:\mongodb\ and you created c:\mongodb\data\ then within c:\mongodb\bin\mongodb.config you would specify dbpath=c:\mongodb\data\. You could then launch mongod from a command prompt via c:\mongodb\bin\mongod --config c:\mongodb\bin\mongodb.config.
Feel free to add the bin folder to your path to make all of this less verbose. MacOSX and Linux users can follow almost identical directions. The only thing you should have to change are the paths.
Hopefully you now have MonogDB up and running. If you get an error, read the output carefully- the server is quite good at explaining what's wrong.
You can now launch mongo (without the d) which will connect a shell to your running server. Try entering db.version() to make sure everything's working as it should. Hopefully you'll see the version number you installed.
作者努力翻译,希望转载者注明文章出处及作者。谢谢
这本书将专注于MongoDB的功能性。因此,我们将依赖MongoDB的shell。作为一个管理工具,shell的学习是非常有用的,你的代码将使用MongoDB的驱动程序。
有关DongoDB你第一个需要了解的是:驱动程序。MongoDB有各种不同语言的官方驱动。你可以把这些驱动理解为你可能已经非常了解的其它各种数据库的驱动器。在这些驱动器上,开发社区已经建立了更多的语言/框架库。例如,NoRM是一个实现LINQ的C#库,MongoMaper是一个ActiveRecord-friendly 的ruby库。你可以选择直接使用MongoDB核心驱动或者一些更高级别的库。我指出这些的原因是因为很多新接触MongoDB的人对于为什么同时存在官方驱动和社区驱动感到很混乱-前者更多的关注于MongoDB核心的通信/连通性,后者更多的关注于语言和框架的特定实现。
读到这,我鼓励你们把我的示例复制到你自已的MongoDB上,这样可以使你发现问题。运行MongoDB非常的简单,我们用几分钟把事情解决。
1 根据你的系统去官网下载适当的二进制文件,你可以选择32位或64位。
2 解压归档文件并进入bin子目录。不要直接运行,mongodb是一个服务器进程而mongo是一个客户端的shell-我们将在这两个可
执行花费大量的时间。
3 在bin目录下建立一个mongodb.config文件
4 在mongodb.config文件下添加一行dbpath=PATH_TO_WHERE_YOU_WANT_TO_STORE_YOUR_DATABASE_,例如,在windows
下你可能是dbpath=c:\mongodb\data, 在linux下你可能是dbpath=/etc/mongodb/data。
5 确保你指定的目录dbpath存在
6 使用--config /path/to/your/mongodb.config参数启动mongod
Windows用户示例:如果你把下载文件解压到c:\mongodb\ 并且你创建了c:\mongodb\data\ 然后在c:\mongodb\bin\mongodb.config
你指定了dbpath=c:\mongodb\data\,你就可以使用以下命令启动mongod:c:\mongodb\bin\mongod --config c:\mongodb.config。
希望你的MongoDB运行起来。如果你收到错误信息,仔细的阅读输入信息-服务器可非常不错的解释发生了什么错误。
现在你可以运行mongo(没有d)为你的服务器连接一个shell。尝试输入db.version()来确保所有的事情运行正常。希望你看到你安装的版本号。
原文:
Most of this book will focus on core MongoDB functionality. We'll therefore rely on the MongoDB shell. While the shell is useful to learn as well as being a useful administrative tool, your code will use a MongoDB driver.
This does bring up the first thing you should know about MongoDB: its drivers. MongoDB has a number of official drivers for various languages. These drivers can be thought of as the various database drivers you are probably already familiar with. On top of these drivers, the development community has built more language/framework-specific libraries. For example, NoRM is a C# library which implements LINQ, and MongoMapper is a Ruby library which is ActiveRecord-friendly. Whether you choose to program directly against the core MongoDB drivers or some higher-level library is up to you. I point this out only because many people new to MongoDB are confused as to why there are both official drivers and community libraries - the former generally focuses on core communication/connectivity with MongoDB and the latter with more language and framework specific implementations.
As you read through this, I encourage you to play with MongoDB to replicate what I demon-strate as well as to explore questions that might come up on your own. It's easy to get up and running with MongoDB, so let's take a few minutes now to set things up.
1. Head over to the official download page and grab the binaries from the first row (the recommended stable version) for your operating system of choice. For development purposes, you can pick either 32-bit or 64-bit.
2. Extract the archive (wherever you want) and navigate to the bin subfolder. Don't execute anything just yet, but know that mongod is the server process and mongo is the client shell- these are the two executables we'll be spending most of our time with.
3. Create a new text file in the bin subfolder named mongodb.config
4. Add a single line to your mongodb.config: dbpath=PATH_TO_WHERE_YOU_WANT_TO_STORE_YOUR_DATABASE_F
. For example, on Windows you might do dbpath=c:\mongodb\data and on Linux you might do dbpath=/etc/mongo/data.
5. Make sure the dbpath you specified exists
6. Launch mongod with the --config /path/to/your/mongodb.config parameter.
As an example for Windows users, if you extracted the downloaded file to c:\mongodb\ and you created c:\mongodb\data\ then within c:\mongodb\bin\mongodb.config you would specify dbpath=c:\mongodb\data\. You could then launch mongod from a command prompt via c:\mongodb\bin\mongod --config c:\mongodb\bin\mongodb.config.
Feel free to add the bin folder to your path to make all of this less verbose. MacOSX and Linux users can follow almost identical directions. The only thing you should have to change are the paths.
Hopefully you now have MonogDB up and running. If you get an error, read the output carefully- the server is quite good at explaining what's wrong.
You can now launch mongo (without the d) which will connect a shell to your running server. Try entering db.version() to make sure everything's working as it should. Hopefully you'll see the version number you installed.
作者努力翻译,希望转载者注明文章出处及作者。谢谢