Files
mongo/client/model.cpp

34 lines
958 B
C++
Raw Normal View History

2008-10-24 17:51:28 -04:00
// model.cpp
/**
* Copyright (C) 2008 10gen Inc.
2008-12-28 20:28:49 -05:00
*
2008-10-24 17:51:28 -04:00
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
2008-12-28 20:28:49 -05:00
*
2008-10-24 17:51:28 -04:00
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
2008-12-28 20:28:49 -05:00
*
2008-10-24 17:51:28 -04:00
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "stdafx.h"
#include "model.h"
2009-01-14 17:09:51 -05:00
namespace mongo {
bool Model::load(BSONObj& query) {
BSONObj b = conn()->findOne(getNS(), query);
if ( b.isEmpty() )
return false;
2008-10-24 17:51:28 -04:00
unserialize(b);
return true;
}
2009-01-14 17:09:51 -05:00
} // namespace mongo